4 ms·
I created this logrotate rule to rotate the docker json log files: /var/lib/docker/containers/*/*-json.log { copytruncate rotate 2 size 40M
by ploxiln 11y ago
I created this logrotate rule to rotate the docker json log files:
/var/lib/docker/containers/*/*-json.log {
copytruncate
rotate 2
size 40M
missingok
nocreate
nocompress
}
But for most services I still mount a log dir and redirect stdout and stderr to a file manually, since neither the json log format nor that directory structure are particularly convenient for my purposes.
More recent docker releases have added other logging drivers, and added options to the "json-file" logging driver for "max-size" and "max-file", which sounds appropriate, but that came after I worked around the problem and I haven't upgraded yet.