Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Dec 1999 16:26:41 -0000
From:      "Nicholas J. Dear" <ndear@areti.net>
To:        "Randy A. Katz" <randyk@ccsales.com>
Cc:        freebsd-isp@FreeBSD.ORG
Subject:   Re: Rotate httpd logs
Message-ID:  <199912061627.QAA32337@post.mail.areti.net>
In-Reply-To: <3.0.5.32.19991206080611.0356bab0@ccsales.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 6 Dec 99, at 8:06, Randy A. Katz wrote:

> Hi,
> 
> 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.

#!/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

Our logging is set up so each virtual server has its own directory for logging, but the script could easily be 
modified if you don't follow this:

/usr/local/apache/logs/www.domainame/

rotate.monthly.txt then simply contains a list of "www.domainame" which reflects the directory
structure, one on each line.

then just bung it into crontab for however often you want it to run.

N.
--
Nicholas J. Dear
Mail: ndear@areti.net Tel: +44 (0)20-8402-4041
Areti Internet Ltd., http://www.areti.co.uk/


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?199912061627.QAA32337>