Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Dec 2001 12:33:02 +0100 (CET)
From:      Michal Mertl <mime@traveller.cz>
To:        questions@freebsd.org
Subject:   Re: problem with apache log (newsyslog proposal)
Message-ID:  <Pine.BSO.4.21.0112041116090.5444-100000@prg.traveller.cz>

next in thread | raw e-mail | index | archive | help
The reason you couldn't realiably compress apache's logfiles is that after
renaming the log, the daemon process still writes to the old log file.

Details: When you make it reopen the log (by sending USR1) new connections
(ones handled with children who have already restarted) get logged to the
new file. The ones which started before the signal was delivered are
logged to the old file. With HUP delivered to master apache process the
children are rather abruptly killed (thus all new log entries go the the
new file). If you don't mind killing some downloads from your site
(clients get only partial downloads) sending HUP should enable you to
compress the logs. If you don't like interrupted downloads (imagine 10MB
file over 56k modem interrupted at 9MB (client looses ~22 minutes) and
want to compress the logs, you can either compress them separately from
rotation much later (~hours to be sure) or you can rotate using some
script which monitors if the old log file is still open by some children
and start the compression only after there's no such children. I have
small script for that if someone is interested.

I think there can be flag in newsyslog to make it check if there's a
process which has open the file which is to be compressed and postpone the
compression until either no such child exists or some timeout is hit. If
anyone thinks it's a good idea, I can try to implement that functionality.


-- 
Michal Mertl
mime@traveller.cz



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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