gliderlabs / logspout

Log routing for Docker container logs
MIT License
4.66k stars 680 forks source link

Some guidance to create a slack notifier adapter #489

Closed claustres closed 4 years ago

claustres commented 4 years ago

I am trying to create a slack notifier adapter but get some trouble. The current source code can be viewed here. I build a custom image like explained in docs, here is the build command. I run it in a Docker Swarm using this config.

So far so good, I can see the logs on each host with curl http://127.0.0.1:8000/logs. The adapter seems to be correctly detected as well as the logspout container logs are the following:

2020/10/20 21:47:15 # logspout v3.2.11-custom by gliderlabs
2020/10/20 21:47:15 # adapters: slack multiline raw syslog tcp tls udp
2020/10/20 21:47:15 # options :
2020/10/20 21:47:15 backlog:false
2020/10/20 21:47:15 persist:/mnt/routes
2020/10/20 21:47:15 # jobs    : pump routes http[health,logs,routes]:80
2020/10/20 21:47:15 # routes  :
#   ADAPTER     ADDRESS         CONTAINERS      SOURCES         OPTIONS
#   slack       localhost:80    *               stdout,stderr   map[]

However the module does not seem to be really loaded as the following statement should print something. No log seems to pop up in my listening function although I should catch all container logs with my config.

What am I doing wrong ? Thanks.

claustres commented 4 years ago

I am not completely sure about that but it appears that if my adapter does not come first in the modules.go when building the container it does not receive any message, would it be possible?

claustres commented 4 years ago

My bad, this is related to something else as it seems to work fine now.