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 ...
--log-opt
option that could give you what you need. Source: blog.treasuredata.com/blog/2015/07/07/… – Kilohertz