Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Mar 2007 13:56:59 -0500
From:      "David Robillard" <david.robillard@gmail.com>
To:        "FreeBSD Questions" <freebsd-questions@freebsd.org>
Cc:        Peter Pluta <peter@placidpublishing.net>
Subject:   Re: Apache Rotate Logs and Log Rotate.
Message-ID:  <226ae0c60703051056ofb18dffu1ea0b9d48297b0bf@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
On 3/3/07, Peter Pluta <peter@placidpublishing.net> wrote:
>> I see, thanks. Does the shell script you use automatically delete the
>> original logs after verbalizer or awstats makes it's own? I imagine the
>> ones those programs use are smaller in size?
>
> No, the shell script does not delete any logs. Log rotation and
> compression is the job of newsyslog.

Alright, after some more RTFM on Apache logs, here's what your
newsyslog.conf(5) configuration should look like.

/var/log/httpd/access.log                            640 5 1048576 * B
/var/run/httpd.pid 30
/var/log/httpd/error.log                                640 5 1048576
* B /var/run/httpd.pid 30

Of course, you should taylor this to suit your own needs (like the
size, ownership and number logs kept on disk, etc.)

But keep the "B" flag for Binary which will prevent newsyslog from
adding a line in your logs which says it was rotated. It _may_ confuse
some log analyser (depends on your log analyser software). Also make
sure to add the "30" at the end of each line. This is the kill(1)
number for signal -USR1 which gracefully restarts Apache.

Now the reason I removed the "Z" flags, which eliminates compression,
is to make sure all of your children httpd processes have enough time
to write their logs into the log file. If a request on your site is
rather long, them this is the best way to go. Of couse, that means you
will need a little bit more disk space. But not that much depending on
how much logs you keep (i.e. 5 in the example above).

HTH,

David
-- 
David Robillard
UNIX systems administrator & Oracle DBA
CISSP, RHCE & Sun Certified Security Administrator
Montreal: +1 514 966 0122



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