1 |
On Wed, Aug 3, 2011 at 12:31 PM, Jarry <mr.jarry@×××××.com> wrote: |
2 |
> But is it actually necessary to do it? I mean everything between |
3 |
> postrotate-endscript is done after the log file has been rotated. |
4 |
|
5 |
The log file has been moved, but Apache still holds open the file |
6 |
descriptor to the old log file--it will continue writing to that file, |
7 |
even under its new name. |
8 |
|
9 |
> So I do not understand why at that time apache must be reloaded. |
10 |
|
11 |
The reload causes Apache to close the file descriptor, and then open |
12 |
the file again. Since it *opens* the file by name, it will start with |
13 |
a fresh log file. |
14 |
|
15 |
> |
16 |
> Moreover, because of that apache-reloading apc was emptied so it |
17 |
> takes again some time till all php-scripts are in cache again... |
18 |
|
19 |
What you really want is for the logrotate script to ask Apache to |
20 |
flush its logs and reopen the file. I don't know offhand if Apache has |
21 |
a way to do that, short of a graceful restart. |
22 |
|
23 |
-- |
24 |
:wq |