Docker:Logging
lastmod 2021-03-12created 2021-02-268 edits
How to do logging in Docker.
Drivers
Local File logging driver
Options:
| Option</code> | | <code>Example value |
| | The maximum size of the log before it is rolled. A positive integer plus a modifier representing the unit of measure ( | |
| | The maximum number of log files that can be present. If rolling the logs creates excess files, the oldest file is removed. A positive integer. Defaults to 5. | |
| | Toggle compression of rotated log files. Enabled by default. | |
Graylog Extended Format logging driver
- Graylog Extended Format logging driver | Docker Documentation
- Gist - Send docker logs to ELK through gelf log driver
- Gist - Example of logging with docker gelf logger to logstash
- Send Your Docker Container Logs to ELK (Elasticsearch, Logstash and Kibana) with Gelf Driver (Docker:Logging, GEFL, Elasticsearch, Logstash, Kibana)
How to output in the GEFL format of Graylog:
docker run --log-driver gelf --log-opt gelf-address=udp://localhost:12201 --rm -it ubuntu bash -c 'while true; do echo kkkkk; sleep 1; done'
See Logstash#Docker GELF logging for details.
For reference, gelf stands for Graylog Extended Log Format.