[squid-users] Log Rotate

From: Matt <lm7812_at_gmail.com>
Date: Fri, 16 Apr 2010 14:26:19 -0500

I am running squid3-3.1.0.15-1 on CentOS. I have this for log rotate:

/etc/logrotate.d/squid

/var/log/squid/access.log /var/log/squid/cache.log /var/log/squid/store.log {
    daily
    missingok
    nocompress
    noolddir
    sharedscripts
    postrotate
        DATE=`/bin/date --date=yesterday +%y%m%d`
        LOGDIR="/var/log/squid"
        /usr/sbin/squid -k rotate 2>/dev/null || true
        sleep 10
        for LOGFILE in ${LOGDIR}/*.log; do
          [ -f ${LOGFILE}.1 ] && mv ${LOGFILE}.1 ${LOGFILE}-${DATE}
          [ -f ${LOGFILE}-${DATE} ] && /bin/gzip ${LOGFILE}-${DATE}
        done
        /usr/bin/find ${LOGDIR}/ -type f -name "*.log-*.gz" -mtime +30
-exec rm -f {} \;
    endscript
}

It never seems to ratate the logs though. Any idea why?

Matt
Received on Fri Apr 16 2010 - 19:26:30 MDT

This archive was generated by hypermail 2.2.0 : Sat Apr 17 2010 - 12:00:05 MDT