Docker: Logging

Docker Engine/daemon logs

can be viewed using

journalctl -u docker.service

if using a systemd Linux.

If not, try /var/log/messages

 

Container / App logs

PID 1 goes to STDOUT, STDERR

If logging to a file then could symlink or mount a volume to that location.

Otherwise, use a logging driver.

Logging Drivers

syslog, Gelf, Splunk, Fluentd

Just set the default logging driver in daemon.json

Can override per-container with --log-driver --log-opts

Note: default is JSON.

Can inspect logs with docker logs <container> but note, doesn’t work with all drivers.

Leave a Reply

Your email address will not be published. Required fields are marked *