Bug 67224 - The Logrotate for apache sometimes will not restart apache
Summary: The Logrotate for apache sometimes will not restart apache
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: apache
Version: 7.3
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Joe Orton
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-06-21 09:02 UTC by Need Real Name
Modified: 2007-04-18 16:43 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-09-21 10:17:04 UTC
Embargoed:


Attachments (Terms of Use)

Description Need Real Name 2002-06-21 09:02:43 UTC
The Apache RPM installs its logrotate piece into /etc/logrotate.d/apache

The postrotate command in this file is ...
/bin/kill -HUP `cat /var/run/httpd.pid 2> /dev/null` 2> /dev/null || true

The problem is that Apache sometimes writes its Process ID into /var/run/httpd.pid and
sometimes into /var/run/httpsd.pid.  In the latter case, the server does NOT get restarted
by logrotate and thus, the Apache keeps writing logs into the newly renamed and rotated
access_log.1, etc.

First, this effectively disables the logrotate function as all data still goes into the same file
(based on the inode number that Apache originally opened) and secondly, after 4 weeks,
when the active file gets deleted by logrotate, bad things happen,  the best case scenario
is that logging gets lost and the worst case is file corruption or server crash.

When Apache is used in SSL mode with a valid key, it stores its Process ID in httpsd.pid.
However, on servers that do not run with a secure key or in secure mode, Apache sometimes
writes to httpd.pid and sometimes httpsd.pid.  I have not been able to figure out what the
determining factor is.  I have to start Apache, look in /var/run and see what file Apache is using
and manually change the logrotate config file for apache.  Once done, it seems to work forever
However, this is something that should be automatic.  The easiest fix is to change the
postrotate part of the /etc/logrotate.d/apache file to check which "pid" file exists and then
restart based on that, but the correct fix is to make Apache consistent.

This bug seems to affect all versions of RedHat Linux, up through the current release.

Comment 1 Joe Orton 2004-09-21 10:17:04 UTC
Thanks for the report.  This bug is no longer present in the Apache
httpd 2.0 packages in Red Hat Enterprise Linux and Fedora Core.



Note You need to log in before you can comment on or make changes to this bug.