[squid-users] logrotate/squid -k rotate relationship

From: <[email protected]>
Date: Mon, 2 Oct 2006 16:14:55 -0700 (PDT)

Hi,

The requirement is simple enough:

"rotate the logs every day and name them by date, keep the plain filename
for the current running log (cache.log, access.log) keep them for 60 days,
no compression, NO restart of squid due to high traffic load".

e.g. an "ls -al" in my logs dir the "day after" I get this right would
look like:

access.log (active log -we use multitail, keep name!)
cache.log (active log)
20061003_access.log (archived)
20061003_cache.log (archived)

Having read man pages, searched your mail archives and found a great deal
of useful info, as well as the well-organized FAQ, it's still vague as to
the relationship logrotate script, and squid -k rotate share.

After querying the centos list OT on this, and getting completely opposite
answers from my fellow sysadmins there, it's clear that not too many
people actually understand how all of this works, probably the 'two
different projects' element.

My question is simple: Which files *only* do I need to edit to get my
stated requirement into action?

My homework thus far on this is as follows:

Known Files:
/etc/squid.conf
/etc/crontab
/etc/cron.daily/logrotate
/etc/logrotate.conf
/etc/logrotate.d/squid

1. Edit, or do not bother to edit cron via crontab -e and simply make an
entry for every night and execute /usr/sbin/squid -k rotate like this:

30 11 * * * /etc/rc.d/init.d/squid -k rotate

2. Don't bother editing crontab -e, just let /etc/cron.daily/logrotate
invoke /etc/logrotate.d/squid which looks like this (snipped for clarity):

/var/log/squid/access.log {
    daily
    rotate 60 # should this be "keep 60"?
    copytruncate
    notifempty
    missingok
}
# This script asks squid to rotate its logs on its own.
    postrotate
    /usr/sbin/squid -k rotate
    endscript
}

3. Turn off log rotation in squid.conf (done)

4. Turn on, don't turn on 'postrotate' by calling it in
/etc/logrotate.d/squid and invoking /usr/sbin/squid -k rotate.

5. -k rotate when invoked doesn't stop squid, it just issues USR1 and you
don't have to worry about squid itself stopping (whew).

----
p.s. If anyone knows of a logrotate list i'd like to ask them some
questions also:
A.  Does logrotated run automatically in centos or do I need to invoke
with cron or chkconfig?
B.  For those interacting with squid only, do you need to delete the other
files present under /etc/logrotate.d/ to in effect "turn them off"?
Thanks alot of any input, -we really enjoy using your caching server
technology, it's been a great benefit to our business.  I've made sure to
donate to your project in the past and look forward to helping out in the
future.
-karl
Received on Mon Oct 02 2006 - 17:14:57 MDT

This archive was generated by hypermail pre-2.1.9 : Wed Nov 01 2006 - 12:00:04 MST