Search squid archive

Re: Log Rotate

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

 



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


NP: 3.1 beta are all now unsupported. Please upgrade to 3.1.1 or later.

/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

Going by the package name, "squid3" probably means the binary is also named "squid3" instead of "squid". That means your squid may not be receiving the rotate signal. Run it without that "2>/dev/null ||true" and see if any errors are happening.

        sleep 10
        for LOGFILE in ${LOGDIR}/*.log; do
          [ -f ${LOGFILE}.1 ] && mv ${LOGFILE}.1 ${LOGFILE}-${DATE}

Part of the problem is this:
   loop only considers file with extension .log
     file is only dated if it has extension .1  !!!

          [ -f ${LOGFILE}-${DATE} ] && /bin/gzip ${LOGFILE}-${DATE}
        done
        /usr/bin/find ${LOGDIR}/ -type f -name "*.log-*.gz" -mtime +30
-exec rm -f {} \;

What does this do? erase the file just now created and zipped?

    endscript
}

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



As a side note;
The new logdaemon could fairly easily gain the ability to write those dated files directly based on the individual log timestamp. If you or anyone else using this type of script wants to delve into the helper code and make it so I'm happy to mentor the effort. Just don't have time to do it myself yet.

Amos
--
Please be using
  Current Stable Squid 2.7.STABLE9 or 3.1.1

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux