[squid-users] log rotation

Zbigniew Szalbot zbigniew at szalbot.homedns.org
Wed Jul 25 14:01:23 UTC 2007


Hello,

On Wed, 25 Jul 2007 18:50:27 +0545, Tek Bahadur Limbu
<teklimbu at wlink.com.np> wrote:
> 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

Thank you very much indeed! But I managed in a (I think simpler way by
adding 
/usr/local/squid/logs/access.log        squid:squid     644  7   *   @T00  
    J       /usr/local/squid/logs/squid.pid      30
to newsyslog.conf

But I appreciate such a thorough description!

Warm regards,

Zbigniew Szalbot

> 
> ######### 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
-- 
Zbigniew Szalbot



More information about the freebsd-questions mailing list