[CentOS] Logrotate in CentOS 5.4 more brutal (to httpd at least) than in 5.3?

Wed Feb 3 18:59:50 UTC 2010
nate <centos at linuxpowered.net>

Matthew Miller wrote:

> That said, *both* of them are too brutal, in that they'll kill any open
> connections. Signal USR1 (or service httpd graceful) is much nicer, since it
> lets any open connections complete. The downside is that these old
> connections might get written to the _rotated_ log instead of the new one,
> but to me that's a small price to pay.

I've always used copytruncate for httpd logs and logrotate, never
bothered to send signals to apache at all...

sample config -

"/path/to/logs/*www*log" {
        daily
        rotate 1
        nocompress
        notifempty
        copytruncate
        missingok
        sharedscripts

        olddir /path/to/archivedir

        postrotate
                DATE=`date --date=Yesterday +%y%m%d`
                cd /path/to/archivedir
                for FOO in `ls *.1`
                do
                        mv $FOO `echo $FOO | cut -f1 -d.`.$DATE.log
                done
                gzip -9 *.$DATE.log
                sleep 60
                sync
                logger "[LOGROTATE] Rotated these logs: `echo
*.${DATE}.log.gz`"
        endscript

}


nate