
上QQ阅读APP看书,第一时间看更新
Logging drivers
Docker includes multiple logging mechanisms to help us to get information from running containers. These mechanisms are named logging drivers. Which logging driver is used can be configured at the Docker daemon level. The default logging driver is json-file. Some of the drivers that are currently supported natively are as follows:
Driver
Description
none No log output for the specific container is produced.
json-file This is the default driver. The logging information is stored in files, formatted as JSON.
journald If the journals daemon is running on the host machine, we can use this driver. It forwards logging to the journald daemon.
syslog If the syslog daemon is running on the host machine, we can configure this driver, which will forward the log messages to the syslog daemon.
gelf When using this driver, log messages are written to a Graylog Extended Log Format (GELF) endpoint. Popular examples of such endpoints are Graylog and Logstash.
fluentd Assuming that the fluentd daemon is installed on the host system, this driver writes log messages to it.
If you change the logging driver, please be aware that the docker container logs command is only available for the json-file and journald drivers.