Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the app-name sent by docker's syslog driver

I'm using Papertrail to collect my Docker container's logs. Do to that, I used the syslog driver when I created the container:

sudo docker run --name my_container --log-driver=syslog  ...

... and added the following line to my /etc/rsyslog.conf

*.* @logsXXX.papertrailapp.com:YYYY

At the end, I get on Papertrail logs like this:

Apr 24 13:41:55 ip-10-1-1-86 docker/3b00635360e6: 10.0.0.5 - - [24/Apr/2015:11:41:57 +0000] "GET /healthcheck HTTP/1.1" 200 0 "-" "" "-"

The problem is that the app-name (see syslog RFC) is docker/container_id

I would rather have the container name (or host). But I don't know how to do. I tried to set a specific hostname to my container like below, but it didn't work better:

sudo docker run --name my_container -h my_container --log-driver=syslog  ...
like image 363
vcarel Avatar asked Apr 24 '15 11:04

vcarel


1 Answers

You can't do it. Here's a pending PR to add that feature: https://github.com/docker/docker/pull/12668

Hopefully it gets merged in soon. You could always roll your own, I suppose.

Update: Looks like this is slated for Docker 1.8

Update: This is now possible:

docker run --name my_container --log-driver=syslog --log-opt syslog-tag=my_application
like image 156
Nathaniel Waisbrot Avatar answered Oct 15 '22 02:10

Nathaniel Waisbrot