View previous topic :: View next topic |
Author |
Message |
pachanga Tux's lil' helper


Joined: 03 Dec 2004 Posts: 123 Location: Russia, Penza
|
Posted: Tue Nov 22, 2005 10:49 am Post subject: apache 1.3 and logrotate issues(apache restart fails) |
|
|
Folks, i searched the forum for some time and didn't find an answer on what may be causing apache 1.3 fail to restart during logrotating. Well, actually i found a couple of threads on the same problem with logrotate and apache 2 but still no solution or maybe i just didn't get it
Basically, here's what happens. Every night all apache logs are logrotated, once a week or even more often apache fails to restart for some reason... Here's the /etc/logrotate.conf snippet which is responsible for apache logs rotating and restarting:
Code: |
...
#apache logs
/var/log/apache/*_log {
daily
rotate 13
olddir /var/log/apache/old
sharedscripts
postrotate
/etc/init.d/apache restart > /dev/null
endscript
}
...
|
I also have monit monitoring apache running status and for some reason it fails to restart apache as well once logrotate chokes Here's the /etc/monitrc excerpt:
Code: |
...
# Apache
check process apache with pidfile /var/run/apache.pid
start program = "/etc/init.d/apache start"
stop program = "/etc/init.d/apache stop"
if failed port 80 protocol http with timeout 15 seconds
then restart
if failed port 443 with timeout 15 seconds
then restart
if cpu is greater than 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if children > 250 then restart
if loadavg(5min) greater than 10 for 8 cycles then restart
group www
...
|
Any ideas on what maybe causing this? _________________ Gentoo community rocks! LIMB - a WACT powered CMF tested with SimpleTest
Last edited by pachanga on Tue Nov 22, 2005 1:08 pm; edited 1 time in total |
|
Back to top |
|
 |
Quincy Apprentice


Joined: 02 Jun 2005 Posts: 203 Location: Germany
|
Posted: Tue Nov 22, 2005 1:03 pm Post subject: |
|
|
Perhaps a timing problem? I had similar problems while doing "apachectl graceful": Output said that the reload was OK, but the process was gone...
Changed logrotate to "copytruncate" and didn't restart apache at all to get around this problem.... |
|
Back to top |
|
 |
pachanga Tux's lil' helper


Joined: 03 Dec 2004 Posts: 123 Location: Russia, Penza
|
Posted: Tue Nov 22, 2005 1:07 pm Post subject: |
|
|
Quincy wrote: | Perhaps a timing problem? I had similar problems while doing "apachectl graceful": Output said that the reload was OK, but the process was gone...
|
I don't really know...
Quote: |
Changed logrotate to "copytruncate" and didn't restart apache at all to get around this problem.... |
Thanks a lot, at least it sounds as a good workaround. Still it's interesting to know what's the original root of the problem... _________________ Gentoo community rocks! LIMB - a WACT powered CMF tested with SimpleTest |
|
Back to top |
|
 |
tuxmin l33t


Joined: 24 Apr 2004 Posts: 838 Location: Heidelberg
|
Posted: Tue Nov 22, 2005 2:09 pm Post subject: |
|
|
Most probably a timing problem if you habe lots of open connections.
Why don't you try "apachectl reload" instead? This way there won't be any downtime but apache would reopen it's logs.
Hth, Alex!!! _________________ ALT-F4 |
|
Back to top |
|
 |
pachanga Tux's lil' helper


Joined: 03 Dec 2004 Posts: 123 Location: Russia, Penza
|
Posted: Tue Nov 22, 2005 2:30 pm Post subject: |
|
|
tuxmin wrote: | Most probably a timing problem if you habe lots of open connections.
Why don't you try "apachectl reload" instead? This way there won't be any downtime but apache would reopen it's logs.
|
Well, i thought using /etc/init.d/apache script was the cleanest way... Btw, /etc/init.d/apache reload != apachectl reload, right? _________________ Gentoo community rocks! LIMB - a WACT powered CMF tested with SimpleTest |
|
Back to top |
|
 |
tuxmin l33t


Joined: 24 Apr 2004 Posts: 838 Location: Heidelberg
|
Posted: Tue Nov 22, 2005 2:38 pm Post subject: |
|
|
I'm not sure -- have a look at the script. Maybe it simply calls apachectl.
But I made a typo: use "apachectl restart". Although it's named restart it really does a reload. Unless apache is not running, then it performs a start.
Hth, Alex!!! _________________ ALT-F4 |
|
Back to top |
|
 |
pachanga Tux's lil' helper


Joined: 03 Dec 2004 Posts: 123 Location: Russia, Penza
|
Posted: Wed Nov 23, 2005 7:52 am Post subject: |
|
|
tuxmin wrote: | I'm not sure -- have a look at the script. Maybe it simply calls apachectl.
But I made a typo: use "apachectl restart". Although it's named restart it really does a reload. Unless apache is not running, then it performs a start.
|
Thanks, still i'll stick to "copytruncate" as being the most reliable solution.... _________________ Gentoo community rocks! LIMB - a WACT powered CMF tested with SimpleTest |
|
Back to top |
|
 |
tuxmin l33t


Joined: 24 Apr 2004 Posts: 838 Location: Heidelberg
|
Posted: Wed Nov 23, 2005 8:12 am Post subject: |
|
|
Beware that you probably lose some lines of your your log files when using copytruncate, especially on high traffic.
Alex!!! _________________ ALT-F4 |
|
Back to top |
|
 |
pachanga Tux's lil' helper


Joined: 03 Dec 2004 Posts: 123 Location: Russia, Penza
|
Posted: Wed Nov 23, 2005 8:44 am Post subject: |
|
|
tuxmin wrote: | Beware that you probably lose some lines of your your log files when using copytruncate, especially on high traffic.
|
Yep, i'm aware of the possible log data loss, but it can't be compared to the web server downtime in my case.... Once i'm more familiar with apache restart tricks i'll give it a try again... _________________ Gentoo community rocks! LIMB - a WACT powered CMF tested with SimpleTest |
|
Back to top |
|
 |
|