Is there a way to get logrotate to only compress files modified X number of days ago (e.g. mtime +2)
One option could be to use logrotate
to rotate to a different extension, then use logrotate
to rotate into compressed files:
/var/log/raw.log {
daily
nocompress
extension .old
}
/var/log/*.old {
daily
compress
delaycompress
rotate 10
}
This Rube Goldberg contraption will result in the following:
raw.log
raw.log.old
raw.log.old.1
raw.log.old.2.gz
raw.log.old.3.gz
Thus you have two archived days of logs which are uncompressed.