This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#To create a new Logrotate config file for your Docker containers simply create a new file named /etc/logrotate.d/docker-container and put the following lines to it: | |
/var/lib/docker/containers/*/*.log { | |
rotate 7 | |
daily | |
compress | |
missingok | |
delaycompress | |
copytruncate | |
} | |
# Once you have configured Logrotate for you Docker container you can test it with logrotate -fv /etc/logrotate.d/docker-container. You should get some output and a new log file with suffix [CONTAINER ID]-json.log.1 should be created. This file is compressed in next rotation cycle. |