[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Logrotate postscript not able to find just-compressed log



I want to be able to copy a just-compressed logfile from one machine to
another.  Unfortunately, the following rule does not seem to work as
/var/log/phantom.log.1.gz never seems to be present when the postrotate
script is called.  Is the just-rotated logfile not compressed until
after postrotate is called?  In other words, is this the order of rotate
actions:

	1. prerotate
	2. rotate
	3. postrotate
	4. compress

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?

FYI, here is my logrotate rule:

/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.gz ] ; then 
                    scp -Bq -i /home/phantom/.ssh/id_rsa
/var/log/phantom/phantom.log.1.gz foo@bar.com:log/phantom-`date
+"%Y-%m-%d"`.log.gz
                fi
        endscript
}

thanks,
ian.



Reply to: