Re: Logrotate postscript not able to find just-compressed log
> If this is the case, will I have to compress the just-rotated
> logfile in the postrotate script if I want to copy a compressed file?
The answer is probably "yes". The following rule works on an
uncompressed file:
/var/log/phantom/phantom.log {
daily
missingok
rotate 52
copytruncate
compress
nodelaycompress
create 644 tomcat4 nogroup
postrotate
if [ -e /var/log/phantom/phantom.log.1 ] ; then
scp -Bq -i /home/phantom/.ssh/id_rsa
/var/log/phantom/phantom.log.1 foo@bar.com:log/phantom-`date
+"%Y-%m-%d"`.log
fi
endscript
}
The uncompressed file does not appear after logrotate executes, leading
me to believe that logrotate takes the following steps:
1. prerotate
2. rotate
3. postrotate
4. compress
ian.
Reply to: