Menu

Logging Docker container output to individual files via Syslog

28 October 2015

I'm not big on Rsyslog syntax, it's a bit overwhelming at first, though documentation is plentiful..
Here is how you can log Docker container output to individual files per container (using tags) via Syslog..

Add a template and a route to either main or individual rsyslog config (in my case /etc/rsyslog.d/10-docker.conf):

As of Docker 1.9, tagging logs with --log-opt [syslog-tag/fluentd-tag/gelf-tag] will be replaced with simple --log-opt tag=blah. Using constructs such as {{.Name}}, {{.ID}}, {{.ImageName}} and similar will be possible as well.
For details see GitHub #15384