Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Oct 2005 12:20:15 -0400
From:      Garance A Drosehn <gad@FreeBSD.org>
To:        Jonathan Chen <jonc@chen.org.nz>, Olivier Nicole <on@cs.ait.ac.th>
Cc:        freebsd-questions@FreeBSD.org
Subject:   Re: Apache log rotation
Message-ID:  <p06230903bf7c20db8db6@[128.113.24.47]>
In-Reply-To: <20051019090008.GC86787@osiris.chen.org.nz>
References:  <200510190854.j9J8sFum044816@banyan.cs.ait.ac.th> <20051019090008.GC86787@osiris.chen.org.nz>

next in thread | previous in thread | raw e-mail | index | archive | help
At 10:00 PM +1300 10/19/05, Jonathan Chen wrote:
>On Wed, Oct 19, 2005 at 03:54:15PM +0700, Olivier Nicole wrote:
>
>[...]
>>  Is there a clean way to rotate these logs a la newsyslog?
>>
>>  I know I can use newsyslog to rotate them, but then how to notify
>>  Apache to use the new log files? I don't expect a signal HUP sent to
>>  httpd would be enough.
>
>It is. All you need to make sure that only the last line has the HUP
>to the httpd, as newsyslog works from top to bottom. eg:
>
>/var/log/apache/httpd-access.log    644  12    *    $M1D0 BN
>/var/log/apache/httpd-error.log     644  12    *    $M1D0 B 
>/var/run/httpd.pid

*ALL* lines should include the HUP request.  In the above example
you are rotating at an explicit time, but many people also depend
on the size of the file.  If they do depend on the size of the
file, then the above trick will not always work.

It used to be that you had to do some trick like the above to avoid
sending multiple HUP's to the process.  I changed that so that the
same process can be specified on many log files, and newsyslog will
first rotate all files which need rotating, and then send a single
signal to the process.  So now there is no problem caused by
specifying the same process on multiple entries in newsyslog.conf .

-- 
Garance Alistair Drosehn     =      gad@gilead.netel.rpi.edu
Senior Systems Programmer               or   gad@FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA



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