I need to make a daily rotate of /var/log/messages to be kept for 60 days, where the last 30 logs must be compressed with bzip2.
This is my logrotate config:
/var/log/messages { daily
rotate 60
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
but the result is keeping the last 60 daily not compressed logs. If add compress
, then all 60 logs will be compressed.
So is there a way to make it compress ONLY the last 30 logs?