public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] apache: what could cause "graceful restart requested"?
@ 2011-08-03 16:12 Jarry
  2011-08-03 16:17 ` Michael Mol
  2011-08-03 16:20 ` Paul Hartman
  0 siblings, 2 replies; 8+ messages in thread
From: Jarry @ 2011-08-03 16:12 UTC (permalink / raw
  To: gentoo-user

Hi,
I just noticed my apache-uptime is just a few hours.
Actually, I have found my web-server has been restarted
today at ~03:10 UTC. I have found this message in
/var/log/apache2/error-log
---
[Wed Aug 03 03:10:01 2011] [notice] Graceful restart requested,
  doing restart
---

What could have caused this? BTW I noticed all apache logs
have been rotated exactly at this time. Is that a reason
why apache was restarted? I never noticed it...

Jarry

-- 
_______________________________________________________________
This mailbox accepts e-mails only from selected mailing-lists!
Everything else is considered to be spam and therefore deleted.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] apache: what could cause "graceful restart requested"?
  2011-08-03 16:12 [gentoo-user] apache: what could cause "graceful restart requested"? Jarry
@ 2011-08-03 16:17 ` Michael Mol
  2011-08-03 16:31   ` Jarry
  2011-08-03 16:20 ` Paul Hartman
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Mol @ 2011-08-03 16:17 UTC (permalink / raw
  To: gentoo-user

On Wed, Aug 3, 2011 at 12:12 PM, Jarry <mr.jarry@gmail.com> wrote:
> Hi,
> I just noticed my apache-uptime is just a few hours.
> Actually, I have found my web-server has been restarted
> today at ~03:10 UTC. I have found this message in
> /var/log/apache2/error-log
> ---
> [Wed Aug 03 03:10:01 2011] [notice] Graceful restart requested,
>  doing restart
> ---
>
> What could have caused this? BTW I noticed all apache logs
> have been rotated exactly at this time. Is that a reason
> why apache was restarted? I never noticed it...

Very likely. logrotate would ask apache to restart so that it can move
the old log file out of the way.

-- 
:wq



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] apache: what could cause "graceful restart requested"?
  2011-08-03 16:12 [gentoo-user] apache: what could cause "graceful restart requested"? Jarry
  2011-08-03 16:17 ` Michael Mol
@ 2011-08-03 16:20 ` Paul Hartman
  1 sibling, 0 replies; 8+ messages in thread
From: Paul Hartman @ 2011-08-03 16:20 UTC (permalink / raw
  To: gentoo-user

On Wed, Aug 3, 2011 at 11:12 AM, Jarry <mr.jarry@gmail.com> wrote:
> Hi,
> I just noticed my apache-uptime is just a few hours.
> Actually, I have found my web-server has been restarted
> today at ~03:10 UTC. I have found this message in
> /var/log/apache2/error-log
> ---
> [Wed Aug 03 03:10:01 2011] [notice] Graceful restart requested,
>  doing restart
> ---
>
> What could have caused this? BTW I noticed all apache logs
> have been rotated exactly at this time. Is that a reason
> why apache was restarted? I never noticed it...

Is there perhaps a cron job set to restart apache overnight?



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] apache: what could cause "graceful restart requested"?
  2011-08-03 16:17 ` Michael Mol
@ 2011-08-03 16:31   ` Jarry
  2011-08-03 16:40     ` Michael Mol
  2011-08-03 16:43     ` Florian Philipp
  0 siblings, 2 replies; 8+ messages in thread
From: Jarry @ 2011-08-03 16:31 UTC (permalink / raw
  To: gentoo-user

On 03-Aug-11 18:17, Michael Mol wrote:
>> ---
>> [Wed Aug 03 03:10:01 2011] [notice] Graceful restart requested,
>>   doing restart
>> ---
>> What could have caused this? BTW I noticed all apache logs
>> have been rotated exactly at this time. Is that a reason
>> why apache was restarted? I never noticed it...
>
> Very likely. logrotate would ask apache to restart so that it can move
> the old log file out of the way.

You are right. I just found this in /etc/logrotate.d/apache2 :
/var/log/apache2/*log {
   missingok
   notifempty
   sharedscripts
   postrotate
   /etc/init.d/apache2 reload > /dev/null 2>&1 || true
   endscript
}

But is it actually necessary to do it? I mean everything between
postrotate-endscript is done after the log file has been rotated.
So I do not understand why at that time apache must be reloaded.

Moreover, because of that apache-reloading apc was emptied so it
takes again some time till all php-scripts are in cache again...

Jarry
-- 
_______________________________________________________________
This mailbox accepts e-mails only from selected mailing-lists!
Everything else is considered to be spam and therefore deleted.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] apache: what could cause "graceful restart requested"?
  2011-08-03 16:31   ` Jarry
@ 2011-08-03 16:40     ` Michael Mol
  2011-08-03 16:48       ` Florian Philipp
  2011-08-03 16:43     ` Florian Philipp
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Mol @ 2011-08-03 16:40 UTC (permalink / raw
  To: gentoo-user

On Wed, Aug 3, 2011 at 12:31 PM, Jarry <mr.jarry@gmail.com> 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.

-- 
:wq



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] apache: what could cause "graceful restart requested"?
  2011-08-03 16:31   ` Jarry
  2011-08-03 16:40     ` Michael Mol
@ 2011-08-03 16:43     ` Florian Philipp
  1 sibling, 0 replies; 8+ messages in thread
From: Florian Philipp @ 2011-08-03 16:43 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1352 bytes --]

Am 03.08.2011 18:31, schrieb Jarry:
> On 03-Aug-11 18:17, Michael Mol wrote:
>>> ---
>>> [Wed Aug 03 03:10:01 2011] [notice] Graceful restart requested,
>>>   doing restart
>>> ---
>>> What could have caused this? BTW I noticed all apache logs
>>> have been rotated exactly at this time. Is that a reason
>>> why apache was restarted? I never noticed it...
>>
>> Very likely. logrotate would ask apache to restart so that it can move
>> the old log file out of the way.
> 
> You are right. I just found this in /etc/logrotate.d/apache2 :
> /var/log/apache2/*log {
>   missingok
>   notifempty
>   sharedscripts
>   postrotate
>   /etc/init.d/apache2 reload > /dev/null 2>&1 || true
>   endscript
> }
> 
> But is it actually necessary to do it? I mean everything between
> postrotate-endscript is done after the log file has been rotated.
> So I do not understand why at that time apache must be reloaded.
> 
> Moreover, because of that apache-reloading apc was emptied so it
> takes again some time till all php-scripts are in cache again...
> 
> Jarry

Yes, it is necessary. Apache has to re-open the log files or otherwise
it will keep writing to the already deleted file instead of creating a
new one.

You need to do the same for syslog-ng, BTW. See /etc/logrotate.d/syslog-ng.

Regards,
Florian Philipp



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] apache: what could cause "graceful restart requested"?
  2011-08-03 16:40     ` Michael Mol
@ 2011-08-03 16:48       ` Florian Philipp
  2011-08-03 16:59         ` Jarry
  0 siblings, 1 reply; 8+ messages in thread
From: Florian Philipp @ 2011-08-03 16:48 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1426 bytes --]

Am 03.08.2011 18:40, schrieb Michael Mol:
> On Wed, Aug 3, 2011 at 12:31 PM, Jarry <mr.jarry@gmail.com> 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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] apache: what could cause "graceful restart requested"?
  2011-08-03 16:48       ` Florian Philipp
@ 2011-08-03 16:59         ` Jarry
  0 siblings, 0 replies; 8+ messages in thread
From: Jarry @ 2011-08-03 16:59 UTC (permalink / raw
  To: gentoo-user

On 03-Aug-11 18:48, Florian Philipp wrote:

> 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

Thanks for info. This is what I have been looking for a long time!
I have a central log-server where all logs are collected, rotated
and archived, exept for those of apache. I simply did not know how
to redirect all apache-logs to local syslog, which could forward it
to log-server...

Jarry

-- 
_______________________________________________________________
This mailbox accepts e-mails only from selected mailing-lists!
Everything else is considered to be spam and therefore deleted.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-08-03 17:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-03 16:12 [gentoo-user] apache: what could cause "graceful restart requested"? Jarry
2011-08-03 16:17 ` Michael Mol
2011-08-03 16:31   ` Jarry
2011-08-03 16:40     ` Michael Mol
2011-08-03 16:48       ` Florian Philipp
2011-08-03 16:59         ` Jarry
2011-08-03 16:43     ` Florian Philipp
2011-08-03 16:20 ` Paul Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox