Re: [squid-users] log rotation

From: Tek Bahadur Limbu <teklimbu@dont-contact.us>
Date: Wed, 25 Jul 2007 18:50:27 +0545

Zbigniew Szalbot wrote:
> Hello,
>
> I have looked at wiki but cannot find information about log rotation
> (access & store logs).
>
> How can I do this? Or is it simply a matter of defining log rotation in
> newsyslog.conf (I am on a FreeBSD system)?

Hi Zbigniew,

Go to:

(1.) cd /usr/ports/sysutils/logrotate

(2.) make install clean

(3.) cd /usr/local/etc

(4.) vi /usr/local/etc/logrotate.conf

Put the following in logrotate.conf

######### Start of logrotate.conf #######

# rotate log files weekly
#weekly
daily

# keep 4 weeks worth of backlogs
rotate 7

# send errors to root
#errors root

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
compress

# RPM packages drop log rotation information into this directory
include /usr/local/etc/logrotate.d

/var/log/lastlog {
     monthly
     rotate 12
}

######## End of logrotate.conf ##########

(5.) mkdir -p /usr/local/etc/logrotate.d/

(6.) cd /usr/local/etc/logrotate.d/

(7.) vi /usr/local/etc/logrotate.d/squid

Put the following:

#######Start of squid#########

/var/log/squid/access.log {
     daily
     rotate 90
     copytruncate
     compress
     notifempty
     missingok
}
/var/log/squid/cache.log {
     daily
     rotate 7
     copytruncate
     compress
     notifempty
     missingok
}

(8.) /usr/local/sbin/logrotate -d /usr/local/etc/logrotate.conf

(9.) /usr/local/sbin/logrotate -f /usr/local/etc/logrotate.conf

If some errors are reported, it's normal, just create or touch the
relevant files or directories.

(10.) vi /etc/crontab

Put the following:

0 1 * * * root /usr/local/sbin/logrotate
/usr/local/etc/logrotate.conf > /dev/null 2>&1

(11.) If all works well, you are good to go!!!

Of course, the other simple way of doing this is to run:

squid -k rotate

from /etc/crontab

0 1 * * * root squid -k rotate

Thanking you...

>
> Thank you!
>

-- 
With best regards and good wishes,
Yours sincerely,
Tek Bahadur Limbu
(TAG/TDG Group)
Jwl Systems Department
Worldlink Communications Pvt. Ltd.
Jawalakhel, Nepal
http://www.wlink.com.np
Received on Wed Jul 25 2007 - 07:06:18 MDT

This archive was generated by hypermail pre-2.1.9 : Wed Aug 01 2007 - 12:00:04 MDT