From owner-freebsd-isp Tue Dec 7 2: 0:17 1999 Delivered-To: freebsd-isp@freebsd.org Received: from indyio.rz.uni-sb.de (indyio.rz.uni-sb.de [134.96.7.3]) by hub.freebsd.org (Postfix) with ESMTP id F2BCA14F92 for ; Tue, 7 Dec 1999 02:00:13 -0800 (PST) (envelope-from netchild@Leidinger.net) Received: from mars.rz.uni-sb.de (ns0.rz.uni-sb.de [134.96.7.5]) by indyio.rz.uni-sb.de (8.9.3/8.9.3) with ESMTP id KAA13830279; Tue, 7 Dec 1999 10:59:15 +0100 (CET) Received: from Magelan.Leidinger.net (maxtnt-259.telip.uni-sb.de [134.96.71.130]) by mars.rz.uni-sb.de (8.8.8/8.8.4/8.8.2) with ESMTP id KAA13120; Tue, 7 Dec 1999 10:59:19 +0100 (CET) Received: from Leidinger.net (netchild@localhost [127.0.0.1]) by Magelan.Leidinger.net (8.9.3/8.9.3) with ESMTP id KAA00931; Tue, 7 Dec 1999 10:24:37 +0100 (CET) (envelope-from netchild@Leidinger.net) Message-Id: <199912070924.KAA00931@Magelan.Leidinger.net> Date: Tue, 7 Dec 1999 10:24:36 +0100 (CET) From: Alexander Leidinger Subject: Re: Rotate httpd logs To: ndear@areti.net Cc: randyk@ccsales.com, freebsd-isp@FreeBSD.ORG In-Reply-To: <199912061627.QAA32337@post.mail.areti.net> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On 6 Dec, Nicholas J. Dear wrote: >> >> Just trying to get a clue about how I should rotate httpd logs, how >> frequently, and whether to use rotatelogs (included in Apache) or something >> else. If any of you could share your methods I'd appreciate it. > > I did try using rotatelogs and it went kinda wild, so I wrote my own simple script to do this via crontab. What do you mean with "it went kinda wild"? > #!/bin/sh > TODAY=`date +%Y-%m-%d` > for x in `/bin/cat /var/log/www/rotate.monthly.txt` ; do cd /usr/local/apache/logs/$x ; gzip access_log ; mv access_log.gz access_log.$TODAY.gz ; done > /usr/local/apache/bin/apachectl restart > /dev/null You loose some lines of logging in the worst case with this script. You should first mv the file, restart apache and then gzip it. Or you could do a mv, apachectl graceful, sleep, gzip (no open connection is closed with "graceful", but you need to wait a little bit to be sure the logs are really closed). And if you have verry big logfiles you may want to use gzip -9 oder bzip2 -9. Bye, Alexander. -- Loose bits sink chips. http://netchild.home.pages.de Alexander+Home @ Leidinger.net Key fingerprint = 7423 F3E6 3A7E B334 A9CC B10A 1F5F 130A A638 6E7E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message