Difference between revisions of "Docker logging"

From wikieduonline
Jump to navigation Jump to search
Line 1: Line 1:
Docker support logging to format or different platforms, such as, json-file, syslog, journald, gelf, fluentd, awslogs, splunk, etwlogs, gcplogs and logentries.<ref>https://docs.docker.com/config/containers/logging/configure/</ref>
+
Docker support logging to format or different platforms, such as
* Configuration is done at docker container start time with command <code>docker run -it --log-drive LOG_METHOD CONTAINER_ID</code>
+
* json-file
 +
* syslog
 +
* journald
 +
* gelf
 +
* fluentd
 +
* awslogs
 +
* [[splunk]]
 +
* etwlogs
 +
* gcplogs
 +
* logentries.<ref>https://docs.docker.com/config/containers/logging/configure/</ref>
 +
 
 +
 
 +
Configuration is done at docker container start time with command <code>docker run -it --log-drive LOG_METHOD CONTAINER_ID</code>
 
* Check method configured in a running container:
 
* Check method configured in a running container:
 
<pre>
 
<pre>

Revision as of 11:55, 28 January 2020

Docker support logging to format or different platforms, such as

  • json-file
  • syslog
  • journald
  • gelf
  • fluentd
  • awslogs
  • splunk
  • etwlogs
  • gcplogs
  • logentries.[1]


Configuration is done at docker container start time with command docker run -it --log-drive LOG_METHOD CONTAINER_ID

  • Check method configured in a running container:
docker inspect -f '{{.HostConfig.LogConfig.Type}}' CONTAINER_ID
docker inspect -f '{{.HostConfig.LogConfig}}' CONTAINER_ID

docker inspect <container_id|container_name> | grep -A 5 LogConfig

"LogConfig": {
  "Type": "syslog"
  "Config": {}
}

docker logs CONTAINER_NAME_OR_ID (Docker Community Engine only support: local, json-file and journald)
docker logs CONTAINER_NAME_OR_ID 2>&1 | grep "STRING_TO_SEARCH" (You will need to redirect outputs to be able to grep output)[2]
See https://docs.docker.com/config/containers/logging/ for more information


TOMERGE: Container logging

See also

  • https://docs.docker.com/config/containers/logging/configure/
  • https://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container
  • Advertising: