Bug 735093
Summary: | Logrotate doesn't rotate logs if /var/lib/logrotate.status is corrupted | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 5 | Reporter: | Kamal Maiti <kmaiti> |
Component: | logrotate | Assignee: | Jan Kaluža <jkaluza> |
Status: | CLOSED WORKSFORME | QA Contact: | qe-baseos-daemons |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 5.7 | CC: | manoj.kumar.mbm, pyaduvan, syeghiay, tsmetana |
Target Milestone: | rc | ||
Target Release: | 5.8 | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2013-03-06 07:26:49 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: | |||
Bug Depends On: | |||
Bug Blocks: | 743405 |
Description
Kamal Maiti
2011-09-01 12:43:52 UTC
The log file should be rotated even with this error. Could you attach /var/lib/logrotate.status (or just the longest line from that) to see what exactly is there? Also, do you know how logrotate.status gets corrupted? Hi Jan, Thanks for your reply. I agree with you that log file should be rotated even with this error. Here is this line (it looks syntax issue) : At the line 1218 in /var/lib/logrotate.status, we could see following line : [kmaiti@kmaiti 00523837]$ cat -n logrotate.status |grep 1218 1218 "/u01/h [kmaiti@kmaiti 00523837]$ cat -n logrotate.status |grep 1217 1217 "/u01/home/tomcat/apache-tomcat-5.5.26/logs/xplanner2009-02-15.log" 2010-8-27 [kmaiti@kmaiti 00523837]$ Warm Regards, /kamal It would be interesting to find out how that corruption happened, but I understand it's probably not doable. logrotate.c part of this upstream patch can be used to allow rotation even when state file is corrupted: https://fedorahosted.org/logrotate/changeset/254 . It's already in RHEL6/Fedora. However, it's not possible to do anything with corrupted state file automatically. It has to be checked and fixed manually. This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux. I've tried to reproduce it again and log files are rotate properly even with that error for me. Just to clarify it, are you sure log files are not rotated? The error itself can't be fixed automatically. This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux. I'm not able to reproduce this bug and reporter is not active anymore. Closing as WORKSFORME. [Problem] Logrotate failed if logrotate status file got corrupted. [root]# /usr/sbin/logrotate /etc/logrotate.conf error: line 92 too long in state file /var/lib/logrotate.status error: could not read state file, will not attempt to write into it [Reason] logroatet.c check each line of logrotate status file which is terminated with new line, if it fails it return and exist with error. while (fgets(buf, sizeof(buf) - 1, f)) { argv = NULL; line++; i = strlen(buf); if (buf[i - 1] != '\n') { message(MESS_ERROR, "line %d too long in state file %s\n", line, stateFilename); fclose(f); return 1; } /var/lib/logrotate.status contains line number 92 , which exist without newline and thus causing this issue. 89 "/var/log/vsftpd.log" 2016-3-18 90 "/var/log/actlog.exports/meminfo" 2016-10-8 91 "/var/log/boot.log" 2016-10-2 92 "/var/log/network/update_swi [Workaround] Remove bad line and restart log rotate. [Reference] https://github.com/logrotate/logrotate/issues/78 ---->reproduced |