From owner-freebsd-questions@FreeBSD.ORG Thu Jul 17 12:51:38 2008 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 33DFC106564A for ; Thu, 17 Jul 2008 12:51:38 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id E70208FC0C for ; Thu, 17 Jul 2008 12:51:37 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KJSxK-0006bj-Bg for freebsd-questions@freebsd.org; Thu, 17 Jul 2008 12:51:34 +0000 Received: from utwig.xim.bz ([195.184.197.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 17 Jul 2008 12:51:34 +0000 Received: from c.kworr by utwig.xim.bz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 17 Jul 2008 12:51:34 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-questions@freebsd.org From: Volodymyr Kostyrko Date: Thu, 17 Jul 2008 15:51:25 +0300 Lines: 22 Message-ID: References: <487F2525.3030304@lcwords.com> <20080717072023.4b9e1d2f.wmoran@potentialtech.com> <487F2D9B.2010407@lcwords.com> <200807170904.26354.mario.lobo@ipad.com.br> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: utwig.xim.bz User-Agent: Thunderbird 2.0.0.14 (X11/20080612) In-Reply-To: <200807170904.26354.mario.lobo@ipad.com.br> Sender: news Subject: Re: log size handling 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: Thu, 17 Jul 2008 12:51:38 -0000 Mario Lobo wrote: > On Thursday 17 July 2008, Zbigniew Szalbot wrote: > What would be the proper way to set the rotation of apache logs in > newsyslog.conf when there are separate log files for each virtual host? /var/log/httpd/*.log www:wheel 644 7 102400 * JG /var/run/httpd.pid 30 > Do I have to rotate them myself via a script in crontab? If you want it. ls /var/log/httpd/*.bz2 | sed 's|\.\([0-9]*\)\.|,\1,|' | awk 'BEGIN{FS=","}{print"mv "$1"."$2"."$3" "$1"."$2+1"."$3}' | sh ls /var/log/httpd/*.log | xargs -n1 -Ifoo mv foo foo.0 kill -30 `cat /var/run/httpd.pid` sleep 1 bzip2 -9 /var/log/httpd/*.0 find /var/log/httpd/ -type -f -mtime +7 -delete -- Sphinx of black quartz judge my vow.