I would like to use logrotate to keep no more than 2 backups; hence, rotate 2.
I am going to use a datestamp in the newly generated filename; hence, dateext.
I would like to specify the use of the compression tool "xz"; hence, compresscmd /bin/xz.
Because I am using xz, I know that I also have to specify the extension on the file as ".xz"; hence, compressext .xz.
So, I made a copy of /etc/logrotate.d/syslog and named it /etc/logrotate.d/messages, and initially had the following:
Code: Select all
/var/log/cron
/var/log/maillog
/var/log/secure
/var/log/spooler
{
missingok
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslog.pid 2> /dev/null` 2> /dev/null || true
endscript
}
Code: Select all
/var/log/messages
{
missingok
sharedscripts
dateext
rotate 2
compress
compresscmd /bin/xz
compressext .xz
compressoptions -9 -S .xz
postrotate
/bin/kill -HUP `cat /var/run/syslog.pid 2> /dev/null` 2> /dev/null || true
endscript
}
The file will rotate sometimes, the file will take on the -dateext of the day, the file will not compress at all.
I really need this feature working. Has anyone ever gotten all of the compress[XYZ,etc.. etc...] options to work, ever?