Bug 429873
| Summary: | postrotate running before "compress" finishes | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 5 | Reporter: | Chris Stankaitis <cstankaitis> |
| Component: | logrotate | Assignee: | Daniel Novotny <dnovotny> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | low | Docs Contact: | |
| Priority: | low | ||
| Version: | 5.1 | ||
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2009-09-02 14:40:28 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Chris Stankaitis
2008-01-23 15:47:48 UTC
Are you sure that the compression finishes successfully? Can you see the compressed log on the original system? Yes the Compress does finish, since I have to go back manually and move the logs off box I have to go back and scp of the *.1.gz'ed files which are always there is there perhaps an overall timeout in the code that is saying to finish if you exceed X?? That's why I asked. There's fork; execvp; wait. So until the gzip finishes logrotate should be waiting. I'll try to investigate the problem. Please let me know in case you find out any additional information. Nothing yet... Could you please attach your config file? /var/log/httpd/*log {
daily
rotate 32
missingok
notifempty
compress
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
scp -i /root/.ssh/logsync.id_dsa logsync.3.60:webstats/webstats.lock
. 2>/dev/null || scp -i /root/.ssh/logsync.id_dsa
/var/log/httpd/*domainname.net_access_log.1 /root/webstats.sem
logsync.3.60:webstats
endscript
}
sorry that was the older config.. the current config is exactly the same except it's scp'ing the *1.gz Hi we are still having this problem, now on other systems to where we're trying to move off the .1.gz logfile using scp in the postrotate section.. please advise how we can assist you in troubleshooting this issue. The Config:
/var/log/httpd/*log {
daily
rotate 62
compress
missingok
notifempty
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
/root/movelog.sh
endscript
}
The Script I am running #!/bin/bash # couple of needed variables hostname=`hostname` filename=testdomain.cdn.fm-access_log.1.gz # md5 the rotated *.1.gz logs. cd /var/log/httpd md5sum $filename > /tmp/$hostname-md5sum.txt # Are things being touched on Admin?? if so fail, if not copy logs over scp -i /root/.ssh/movelog.id_dsa castfirelog@admin:movelog.lock . 2>/dev/null || scp -q -p -i /root/.ssh/movelog.id_dsa /tmp/$hostname-md5sum.txt /var/log/httpd/$filename /root/$hostname.sem movelog@admin:$hostname/ I should have read the documentation first... The behaviour you're observing is intentional. See the bug #167575. What confused me was the fact that the log had been copied sometimes. That's why I couldn't find anything in the code that could possibly explain the issue. It looks to be not a bug after all. I forgot... Please change the "postrotate" keyword for "lastaction". It should solve your problem. Okay I have changed my logrotate conf as follows. I'll follow up tomorrow and
confirm that this has solved the issue.
/var/log/httpd/*log {
daily
rotate 62
compress
missingok
notifempty
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
lastaction
/root/castfirelog.sh
endscript
}
This did not resolve the issue, can you confirm that the way I am using the last action command is valid in Comment #13 Once again we do not have the logs copied over as they should be. However if I run the script manually now (Well after logrotation) it will do what it is suppose to do. Using the Logrotate config from Comment #13 I get the following when I try and run logrotate manually.. [root.fmpub.net ~]# logrotate -f /etc/logrotate.d/httpd sh: line 2: lastaction: command not found please advise (In reply to comment #15) > please advise Your script should look like this: /var/log/httpd/*log { daily rotate 62 compress missingok notifempty sharedscripts lastaction /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true /root/castfirelog.sh endscript } i.e., no postrotate, but lastaction instead. Hope this helps. This still doesn't appear to be working correctly.. the only reason I have gotten this to work is because my script now starts with a 600 second sleep.. Is thee any logging or debugging we can turn on with Logrotate to see why this is not working? You can start logrotate with -v parameter, which turns on verbose mode. There is also -d option that turns on the debugging mode -- i.e., only the messages are printed but no log changes are made. Any update on this? I think we should close this one... It's been in needinfo for quite a long time. OK, closing |