Apache log rotation
Garance A Drosehn
gad at FreeBSD.org
Wed Oct 19 09:20:37 PDT 2005
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
*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 at gilead.netel.rpi.edu
Senior Systems Programmer or gad at FreeBSD.org
Rensselaer Polytechnic Institute; Troy, NY; USA
More information about the freebsd-questions