Hi,
This is to answer a question I've been working on this morning and found no good answers for using google.
We put our logs into a cloud log solution. We're using a collection agent (fluentd) to slurp all files matching /var/log/**/*.log
and use logrotate(8) for the rotation and deletion after one day. This is convenient and also ensures part of our GDPR compliance: we don't keep log files around and retention and access to the files are managed in the cloud (sorry, not elk).
Changing all instances of RollingFile
to File
in the supplied log4j2.properties
file stops log4j from rotating the files. Writing a logrotate configuration is relatively easy. As far as I can tell you should use the copytruncate
option when rotating the files.