I am required to use a poorly designed java application that logs A LOT of information while it is running. Under standard usage, it will create 100s of MB of logs per hour.
I don't need historical logs and it currently seems that the logrotate utility can't keep up with it as it doesn't run frequently enough. The application is closed source and rotates it's own logs at around 36MB.
My Linux distribution is RHEL7.
I'd like to reduce wasted space by compressing and rotating the logs.
- As the app already splits out the logs into new files, is it possible to automatically compress newly created files in a directory?
- Is it possible to automatically delete all files in the format of assessor-cli.X.log where X is a digit greater than... say 5 (i.e. keep only the 5 most recent logs).
Here is my attempt at a logrotate file:
# cat /etc/logrotate.d/cis_assessor
This logrotate job would need to catch the log between the size of 30MB and 36MB to actually come into effect which might only be a 10 second period. That's why I'm asking about the manual path of compressing and deleting files without logrotate.