Docker logging
Docker support logging to format or different platforms, such as, json-file, syslog, journald, gelf, fluentd, awslogs, splunk, etwlogs, gcplogs and 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": {} }
- View logs
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
docker-compose logs
TOMERGE: Container logging
See also
- Container logging, Docker logging:
docker logs
,docker-compose logs
- Docker:
docker-compose
, Docker Desktop, Docker Scout, Docker Swarm, Docker Volumes, Docker images management, docker network,docker inspect
,docker volume inspect
,Dockerfile
, Docker Engine release notes,docker kill
,moby
, Docker-in-Docker,docker context
,buildx
,docker tag
,docker system prune
, Docker Hub,hub-tool, /etc/docker/daemon.json
,hostconfig.json
, dockerd, logs, Docker logging, Backup,docker service
,depends on
,--dns, --filter
,--mount
,docker login
,docker build
,apt remove docker.io
,.dockerignore
, docker context ls |docker-machine, .docker/
, PWD,$HOME/.docker/config.json
, Docker ID,--env-file, docker --help
- Linux Logging:
logger
systemd-cat
journalctl
,syslog
,rsyslogd
logrotate
, sshd logs,Logwatch
,logcheck
, Container logging, Journalctl logs,journald.conf
, Docker logs,ts
Advertising: