Am 03.08.2011 18:40, schrieb Michael Mol:
> On Wed, Aug 3, 2011 at 12:31 PM, Jarry <[email protected]> wrote:
>> But is it actually necessary to do it? I mean everything between
>> postrotate-endscript is done after the log file has been rotated.
> 
> The log file has been moved, but Apache still holds open the file
> descriptor to the old log file--it will continue writing to that file,
> even under its new name.
> 
>> So I do not understand why at that time apache must be reloaded.
> 
> The reload causes Apache to close the file descriptor, and then open
> the file again. Since it *opens* the file by name, it will start with
> a fresh log file.
> 
>>
>> Moreover, because of that apache-reloading apc was emptied so it
>> takes again some time till all php-scripts are in cache again...
> 
> What you really want is for the logrotate script to ask Apache to
> flush its logs and reopen the file. I don't know offhand if Apache has
> a way to do that, short of a graceful restart.
> 

I'm not aware of such an option (doesn't mean it doesn't exist, though).
The cleanest solution I can think of is to order apache to send its logs
to syslog. [1] shows how to do this. Of course you still have to reload
syslog-ng when you rotate the log files but apache itself can keep running.

[1] http://oreilly.com/pub/a/sysadmin/2006/10/12/httpd-syslog.html

Hope this helps,
Florian Philipp

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to