From owner-freebsd-questions@FreeBSD.ORG Wed Jul 25 14:01:23 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90DA816A417 for ; Wed, 25 Jul 2007 14:01:23 +0000 (UTC) (envelope-from zbigniew@szalbot.homedns.org) Received: from szalbot.homedns.org (lists.lc-words.com [83.19.156.210]) by mx1.freebsd.org (Postfix) with ESMTP id 2E3D613C45E for ; Wed, 25 Jul 2007 14:01:23 +0000 (UTC) (envelope-from zbigniew@szalbot.homedns.org) Received: from www (helo=www) by szalbot.homedns.org with local for freebsd-questions@freebsd.org; Wed, 25 Jul 2007 16:01:20 +0200 To: Freebsd questions X-PHP-Script: https://poczta.szalbot.homedns.org/index.php for 192.168.11.1 MIME-Version: 1.0 Date: Wed, 25 Jul 2007 16:01:20 +0200 From: Zbigniew Szalbot In-Reply-To: <46A74A97.9060106@wlink.com.np> References: <46A74A97.9060106@wlink.com.np> Message-ID: X-Sender: zbigniew@szalbot.homedns.org User-Agent: RoundCube Webmail/0.1b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Subject: Re: [squid-users] log rotation X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jul 2007 14:01:23 -0000 Hello, On Wed, 25 Jul 2007 18:50:27 +0545, Tek Bahadur Limbu 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