Bug 1148 - Incorrect work of logrotate or apache
: Incorrect work of logrotate or apache
Status: RESOLVED WORKSFORME
Product: Desktop Bugs
Classification: ROSA Desktop
Component: Main Packages
: Marathon
: All Linux
: Normal normal
: ---
Assigned To: ROSA Linux Bugs
: ROSA Linux Bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-03 14:36 MSK by FirstLevel
Modified: 2013-03-01 09:42 MSK (History)
3 users (show)

See Also:
RPM Package: logrotate-3.7.9-6-rosa.lts2012.0.x86_64
ISO-related:
Bad POT generating:
Upstream:


Attachments
httpd.conf (14.31 KB, application/octet-stream)
2012-12-04 09:27 MSK, FirstLevel
Details
logs.tgz (2.73 KB, application/octet-stream)
2013-01-17 09:36 MSK, FirstLevel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description FirstLevel 2012-12-03 14:36:10 MSK
Description of problem:
I have installed Rosa 2012 LTS 64bit with apache. At the end of the month  when logrotate switch logfile all messages for apache are writing to error.log.2. But I have expected that all messages after switching will be writing to error.log.
And only I restart apache its messages redirected to new error.log.
Is that standard situation?
 
#cat /etc/logrotate.d/httpd

/var/log/httpd/*_log /var/log/httpd/apache_runtime_status /var/log/httpd/ssl_mutex {
    rotate 5
    monthly
    missingok
    notifempty
    nocompress
    prerotate
        /etc/rc.d/init.d/httpd closelogs > /dev/null 2>&1 || :
    endscript
    postrotate
        /etc/rc.d/init.d/httpd closelogs > /dev/null 2>&1 || :
    endscript
}


apache-conf-2.2.22-1.1-rosa.lts2012.0.x86_64
apache-base-2.2.22-0.1-rosa.lts2012.0.x86_64
apache-mpm-prefork-2.2.22-0.1-rosa.lts2012.0.x86_64
apache-modules-2.2.22-0.1-rosa.lts2012.0.x86_64
apache-mod_php-5.3.9-3.1-rosa.lts2012.0.x86_64
logrotate-3.7.9-6-rosa.lts2012.0.x86_64

# uname -a
Linux atisot.ru 3.0.38-nrj-desktop-1rosa.lts #1 SMP PREEMPT Tue Jul 24 11:00:04 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
Comment 1 FirstLevel 2012-12-04 09:27:54 MSK
Created attachment 838 [details]
httpd.conf
Comment 2 alexander barakin 2013-01-15 14:47:37 MSK
to identify the culprit (apache or logrotate), do the following:

1. rename current log file:
# mv /var/log/httpd/error_log{,.old}
2. make a wrong request to the server:
$ wget --spider http://your.server.name/non-existent-link
3. a record about "file does not exist" should appear in the saved log file /var/log/httpd/error_log.old
4. tell the server to reopen the log files:
# /etc/init.d/httpd closelogs
5. make a wrong request again:
$ wget --spider http://your.server.name/non-existent-link
6. in the directory /var/log/httpd/ should be a new log file (/var/log/httpd/error_log) with new record about "file does not exist".
Comment 3 FirstLevel 2013-01-16 09:27:52 MSK
(In reply to comment #2)
> to identify the culprit (apache or logrotate), do the following:
> 
> 1. rename current log file:
> # mv /var/log/httpd/error_log{,.old}
> 2. make a wrong request to the server:
> $ wget --spider http://your.server.name/non-existent-link
> 3. a record about "file does not exist" should appear in the saved log file
> /var/log/httpd/error_log.old
> 4. tell the server to reopen the log files:
> # /etc/init.d/httpd closelogs
> 5. make a wrong request again:
> $ wget --spider http://your.server.name/non-existent-link
> 6. in the directory /var/log/httpd/ should be a new log file
> (/var/log/httpd/error_log) with new record about "file does not exist".

3. Yes, message about incorrect request is added to error_log.old
4. After reopenning log file i see that  file error_log was appeared immediately
6. Yes. message about incorrect request is added to error_log
Comment 4 alexander barakin 2013-01-16 13:49:47 MSK
(In reply to comment #3)
> (In reply to comment #2)
> > to identify the culprit (apache or logrotate), do the following:
> > 
> > 1. rename current log file:
> > # mv /var/log/httpd/error_log{,.old}
> > 2. make a wrong request to the server:
> > $ wget --spider http://your.server.name/non-existent-link
> > 3. a record about "file does not exist" should appear in the saved log file
> > /var/log/httpd/error_log.old
> > 4. tell the server to reopen the log files:
> > # /etc/init.d/httpd closelogs
> > 5. make a wrong request again:
> > $ wget --spider http://your.server.name/non-existent-link
> > 6. in the directory /var/log/httpd/ should be a new log file
> > (/var/log/httpd/error_log) with new record about "file does not exist".
> 
> 3. Yes, message about incorrect request is added to error_log.old
> 4. After reopenning log file i see that  file error_log was appeared
> immediately
> 6. Yes. message about incorrect request is added to error_log

hence, apache is working properly.
the error in logrotate.

please do the following:
1. save current state of apache logs:
$ ls -l /var/log/httpd/ > /tmp/state.0
2. in file /etc/logrotate.d/httpd temporary change the two similar lines containing apache invocation.
from:
/etc/rc.d/init.d/httpd closelogs > /dev/null 2>&1 || :
to:
/etc/rc.d/init.d/httpd closelogs >> /tmp/apache.log 2>&1 || :
3. call logrotate:
# logrotate -v -f /etc/logrotate.conf > /tmp/logrotate.log 2>&1
4. save new state of apache logs:
$ ls -l /var/log/httpd/ > /tmp/state.1
5. create archive:
$ tar -czf /tmp/logs.tgz -C /tmp state.0 state.1 apache.log logrotate.log
6. attach /tmp/logs.tgz here
Comment 5 FirstLevel 2013-01-17 09:36:47 MSK
Created attachment 1061 [details]
logs.tgz
Comment 6 FirstLevel 2013-01-17 09:37:03 MSK
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > to identify the culprit (apache or logrotate), do the following:
> > > 
> > > 1. rename current log file:
> > > # mv /var/log/httpd/error_log{,.old}
> > > 2. make a wrong request to the server:
> > > $ wget --spider http://your.server.name/non-existent-link
> > > 3. a record about "file does not exist" should appear in the saved log file
> > > /var/log/httpd/error_log.old
> > > 4. tell the server to reopen the log files:
> > > # /etc/init.d/httpd closelogs
> > > 5. make a wrong request again:
> > > $ wget --spider http://your.server.name/non-existent-link
> > > 6. in the directory /var/log/httpd/ should be a new log file
> > > (/var/log/httpd/error_log) with new record about "file does not exist".
> > 
> > 3. Yes, message about incorrect request is added to error_log.old
> > 4. After reopenning log file i see that  file error_log was appeared
> > immediately
> > 6. Yes. message about incorrect request is added to error_log
> 
> hence, apache is working properly.
> the error in logrotate.
> 
> please do the following:
> 1. save current state of apache logs:
> $ ls -l /var/log/httpd/ > /tmp/state.0
> 2. in file /etc/logrotate.d/httpd temporary change the two similar lines
> containing apache invocation.
> from:
> /etc/rc.d/init.d/httpd closelogs > /dev/null 2>&1 || :
> to:
> /etc/rc.d/init.d/httpd closelogs >> /tmp/apache.log 2>&1 || :
> 3. call logrotate:
> # logrotate -v -f /etc/logrotate.conf > /tmp/logrotate.log 2>&1
> 4. save new state of apache logs:
> $ ls -l /var/log/httpd/ > /tmp/state.1
> 5. create archive:
> $ tar -czf /tmp/logs.tgz -C /tmp state.0 state.1 apache.log logrotate.log
> 6. attach /tmp/logs.tgz here



I have attached file
Comment 7 alexander barakin 2013-01-17 19:01:13 MSK
(In reply to comment #5)
> Created attachment 1061 [details]
> logs.tgz

i see that the apache did not record a single line in the file error_log.
i.e. action "closelogs" did not happen correctly.

hmm.

these packages were updated in november 2012:
apache-base-2.2.22-0.1-rosa.lts2012.0.x86_64
apache-mpm-prefork-2.2.22-0.1-rosa.lts2012.0.x86_64
apache-modules-2.2.22-0.1-rosa.lts2012.0.x86_64

i think it makes sense to upgrade system.
Comment 8 FirstLevel 2013-01-18 13:54:14 MSK
(In reply to comment #7)
> (In reply to comment #5)
> > Created attachment 1061 [details]
> > logs.tgz
> 
> i see that the apache did not record a single line in the file error_log.
> i.e. action "closelogs" did not happen correctly.
> 
> hmm.
> 
> these packages were updated in november 2012:
> apache-base-2.2.22-0.1-rosa.lts2012.0.x86_64
> apache-mpm-prefork-2.2.22-0.1-rosa.lts2012.0.x86_64
> apache-modules-2.2.22-0.1-rosa.lts2012.0.x86_64
> 
> i think it makes sense to upgrade system.

The last test was produced on such packages
# rpm -qa|grep apache
apache-conf-2.2.22-1.1-rosa.lts2012.0.x86_64
apache-mod_php-5.3.9-3.1-rosa.lts2012.0.x86_64
apache-base-2.2.22-0.2-rosa.lts2012.0.x86_64
apache-mpm-prefork-2.2.22-0.2-rosa.lts2012.0.x86_64
apache-modules-2.2.22-0.2-rosa.lts2012.0.x86_64
Comment 9 alexander barakin 2013-01-21 18:07:26 MSK
i can't reproduce bug.

after
# logrotate -f /etc/logrotate.conf
i always see in the output of command
# lsof +D /var/log/httpd/
only files /var/log/httpd/access_log and /var/log/httpd/error_log:
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
httpd    6375   root    2w   REG    8,1     1022 661096 /var/log/httpd/error_log
httpd    6375   root    7w   REG    8,1        0 655737 /var/log/httpd/access_log
httpd   12264 apache    2w   REG    8,1     1022 661096 /var/log/httpd/error_log
httpd   12264 apache    7w   REG    8,1        0 655737 /var/log/httpd/access_log
httpd   12265 apache    2w   REG    8,1     1022 661096 /var/log/httpd/error_log
httpd   12265 apache    7w   REG    8,1        0 655737 /var/log/httpd/access_log
httpd   12266 apache    2w   REG    8,1     1022 661096 /var/log/httpd/error_log
httpd   12266 apache    7w   REG    8,1        0 655737 /var/log/httpd/access_log
httpd   12267 apache    2w   REG    8,1     1022 661096 /var/log/httpd/error_log
httpd   12267 apache    7w   REG    8,1        0 655737 /var/log/httpd/access_log
httpd   12268 apache    2w   REG    8,1     1022 661096 /var/log/httpd/error_log
httpd   12268 apache    7w   REG    8,1        0 655737 /var/log/httpd/access_log
httpd   12269 apache    2w   REG    8,1     1022 661096 /var/log/httpd/error_log
httpd   12269 apache    7w   REG    8,1        0 655737 /var/log/httpd/access_log
httpd   12270 apache    2w   REG    8,1     1022 661096 /var/log/httpd/error_log
httpd   12270 apache    7w   REG    8,1        0 655737 /var/log/httpd/access_log
httpd   12271 apache    2w   REG    8,1     1022 661096 /var/log/httpd/error_log
httpd   12271 apache    7w   REG    8,1        0 655737 /var/log/httpd/access_log

no /var/log/httpd/error_log.1 or something like that.
Comment 10 FirstLevel 2013-01-22 09:48:15 MSK
(In reply to comment #9)
> i can't reproduce bug.
> 
> after
> # logrotate -f /etc/logrotate.conf
> i always see in the output of command
> # lsof +D /var/log/httpd/
> only files /var/log/httpd/access_log and /var/log/httpd/error_log:
> COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
> httpd    6375   root    2w   REG    8,1     1022 661096
> /var/log/httpd/error_log
> httpd    6375   root    7w   REG    8,1        0 655737
> /var/log/httpd/access_log
> httpd   12264 apache    2w   REG    8,1     1022 661096
> /var/log/httpd/error_log
> httpd   12264 apache    7w   REG    8,1        0 655737
> /var/log/httpd/access_log
> httpd   12265 apache    2w   REG    8,1     1022 661096
> /var/log/httpd/error_log
> httpd   12265 apache    7w   REG    8,1        0 655737
> /var/log/httpd/access_log
> httpd   12266 apache    2w   REG    8,1     1022 661096
> /var/log/httpd/error_log
> httpd   12266 apache    7w   REG    8,1        0 655737
> /var/log/httpd/access_log
> httpd   12267 apache    2w   REG    8,1     1022 661096
> /var/log/httpd/error_log
> httpd   12267 apache    7w   REG    8,1        0 655737
> /var/log/httpd/access_log
> httpd   12268 apache    2w   REG    8,1     1022 661096
> /var/log/httpd/error_log
> httpd   12268 apache    7w   REG    8,1        0 655737
> /var/log/httpd/access_log
> httpd   12269 apache    2w   REG    8,1     1022 661096
> /var/log/httpd/error_log
> httpd   12269 apache    7w   REG    8,1        0 655737
> /var/log/httpd/access_log
> httpd   12270 apache    2w   REG    8,1     1022 661096
> /var/log/httpd/error_log
> httpd   12270 apache    7w   REG    8,1        0 655737
> /var/log/httpd/access_log
> httpd   12271 apache    2w   REG    8,1     1022 661096
> /var/log/httpd/error_log
> httpd   12271 apache    7w   REG    8,1        0 655737
> /var/log/httpd/access_log
> 
> no /var/log/httpd/error_log.1 or something like that.

Initiator can not reproduce this situation too.
Comment 11 alexander barakin 2013-01-22 14:09:31 MSK
time to close the bug?
Comment 12 FirstLevel 2013-01-22 15:10:11 MSK
(In reply to comment #11)
> time to close the bug?

I have asked user about it. Please wait for some time
Comment 13 Denis Silakov 2013-03-01 09:42:01 MSK
No answer for more than a month, closing this one.

Mayby this was a transient failure caused by external reasons. At leas I use apache on Marathon for a very long time and don't see any issues with log rotation.