Skip to content

Instantly share code, notes, and snippets.

@tuxpower
Created August 22, 2016 15:07
Show Gist options
  • Save tuxpower/836f0a620cee2c28cb24d9d61c63cd48 to your computer and use it in GitHub Desktop.
Save tuxpower/836f0a620cee2c28cb24d9d61c63cd48 to your computer and use it in GitHub Desktop.
Docker - Managing Log files
$ docker run -d --name redis-server redis
e1da6218780ad8243dfcaf83bd2f712ae981089510a1ba4b67f689f11db54f4a
$ docker logs --tail 10 redis-server
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
1:M 22 Aug 15:02:57.686 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 22 Aug 15:02:57.686 # Server started, Redis version 3.2.1
1:M 22 Aug 15:02:57.687 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 22 Aug 15:02:57.687 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 22 Aug 15:02:57.687 * The server is now ready to accept connections on port 6379
$ docker run -d --name redis-syslog --log-driver=syslog redis
6ced137802b2f1721f7931c387c79d3c3608d5e9c9309377923748fbb0d26511
$ docker inspect --format '{{ .HostConfig.LogConfig }}' redis-syslog
{syslog map[]}
$ docker logs redis-syslog
"logs" command is supported only for "json-file" and "journald" logging drivers (got: syslog)
$ docker run -d --name redis-none --log-driver=none redis
2f6d9e705ced7d65c0bd0f8a0df1502c09b56c097434cf6e79a03d8e2f024872
$ docker logs redis-none
"logs" command is supported only for "json-file" and "journald" logging drivers (got: none)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment