Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Dec 1999 10:24:36 +0100 (CET)
From:      Alexander Leidinger <Alexander@Leidinger.net>
To:        ndear@areti.net
Cc:        randyk@ccsales.com, freebsd-isp@FreeBSD.ORG
Subject:   Re: Rotate httpd logs
Message-ID:  <199912070924.KAA00931@Magelan.Leidinger.net>
In-Reply-To: <199912061627.QAA32337@post.mail.areti.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912070924.KAA00931>