RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 841520 - logrotate is unable to compress log files on NFS mounted directory
Summary: logrotate is unable to compress log files on NFS mounted directory
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: logrotate
Version: 6.4
Hardware: All
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Jan Kaluža
QA Contact: Tomas Dolezal
URL:
Whiteboard:
Depends On:
Blocks: 841837
TreeView+ depends on / blocked
 
Reported: 2012-07-19 09:41 UTC by Ondrej Valousek
Modified: 2013-07-19 00:16 UTC (History)
3 users (show)

Fixed In Version: logrotate-3.7.8-17.el6
Doc Type: Bug Fix
Doc Text:
Cause: Logrotate always tried to set owner of the rotated log even when the owner was the same as the current owner of the log file. Consequence: On filesystems (or systems) where changing the ownership was not supported, the rotation failed. Fix: Before the ownership is changed, Logrotate checks if it is real change of ownership (it means if the new ownership is not the same as the previous one) and skip the change if it isn't real ownership change. Result: Logrotate rotates logs properly on mentioned filesystems (systems).
Clone Of:
: 841837 (view as bug list)
Environment:
Last Closed: 2013-07-18 09:34:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1095 0 normal SHIPPED_LIVE logrotate bug fix update 2013-07-18 13:34:25 UTC

Description Ondrej Valousek 2012-07-19 09:41:06 UTC
Description of problem:
logrotate seems to be unable to compress files on NFSv4 volume.
logrotate -vvv says:
...
compressing log with: /bin/gzip
....

but eventually, logs are not zipped.
Is anyone able to reproduce this?

Comment 2 Ondrej Valousek 2012-07-19 10:03:19 UTC
also note that same settings work fine on RHEL 5.8

Comment 3 Jan Kaluža 2012-07-19 10:11:44 UTC
Could you please attach logrotate configuration file for which it's broken? And also full output of "logrotate -vf /etc/logrotate.d/config.cfg" would be helpful.

Comment 4 Ondrej Valousek 2012-07-19 12:52:05 UTC
[root@dorado projects]# logrotate -vf /etc/logrotate.d/config.cfg
error: cannot stat /etc/logrotate.d/config.cfg: No such file or directory

[root@dorado projects]# cat /etc/logrotate.d/sge
# Example rules for rotating SGE log files with logrotate(1).
# Substitute the actual values of $SGE_ROOT and $SGE_CELL for your
# installation and save it as, say, /etc/logrotate.d/sge

/proj/sge/default/common/accounting {
    compress
    missingok
    notifempty
    maxage 400
    rotate 14
    size 1M
}

/proj/sge/default/spool/*/messages {
    compress
    missingok
    notifempty
    maxage 30
    monthly
    rotate 5
}

/proj/sge/default/common/reporting {
    compress
    missingok
    size 1M
    notifempty
    maxage 400
    rotate 5
}

..note that /proj/sge is NFS mounted.

Comment 5 Jan Kaluža 2012-07-19 18:55:39 UTC
By "/etc/logrotate.d/config.cfg" I meant config used to reproduce this error, so in your case it's: "logrotate -vf /etc/logrotate.d/sge". Could you please run it and paste the output here?

Comment 6 Ondrej Valousek 2012-07-20 09:39:41 UTC
Here you are:

[root@dorado projects]# ls -l /proj/sge/default/common/reporting*
-rw-r--r-- 1 localmgr localmgr 237486 Jul 20 11:32 /proj/sge/default/common/reporting

[root@dorado projects]# logrotate -vf /etc/logrotate.d/sge
reading config file /etc/logrotate.d/sge
reading config info for /proj/sge/default/common/accounting
reading config info for /proj/sge/default/spool/*/messages
reading config info for /proj/sge/default/common/reporting

Handling 3 logs

rotating pattern: /proj/sge/default/common/accounting  forced from command line (14 rotations)
empty log files are not rotated, old logs are removed
considering log /proj/sge/default/common/accounting
  log needs rotating
rotating log /proj/sge/default/common/accounting, log->rotateCount is 14
dateext suffix '-20120720'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /proj/sge/default/common/accounting.14.gz to /proj/sge/default/common/accounting.15.gz (rotatecount 14, logstart 1, i 14),
old log /proj/sge/default/common/accounting.14.gz does not exist
renaming /proj/sge/default/common/accounting.13.gz to /proj/sge/default/common/accounting.14.gz (rotatecount 14, logstart 1, i 13),
old log /proj/sge/default/common/accounting.13.gz does not exist
renaming /proj/sge/default/common/accounting.12.gz to /proj/sge/default/common/accounting.13.gz (rotatecount 14, logstart 1, i 12),
old log /proj/sge/default/common/accounting.12.gz does not exist
renaming /proj/sge/default/common/accounting.11.gz to /proj/sge/default/common/accounting.12.gz (rotatecount 14, logstart 1, i 11),
old log /proj/sge/default/common/accounting.11.gz does not exist
renaming /proj/sge/default/common/accounting.10.gz to /proj/sge/default/common/accounting.11.gz (rotatecount 14, logstart 1, i 10),
old log /proj/sge/default/common/accounting.10.gz does not exist
renaming /proj/sge/default/common/accounting.9.gz to /proj/sge/default/common/accounting.10.gz (rotatecount 14, logstart 1, i 9),
old log /proj/sge/default/common/accounting.9.gz does not exist
renaming /proj/sge/default/common/accounting.8.gz to /proj/sge/default/common/accounting.9.gz (rotatecount 14, logstart 1, i 8),
old log /proj/sge/default/common/accounting.8.gz does not exist
renaming /proj/sge/default/common/accounting.7.gz to /proj/sge/default/common/accounting.8.gz (rotatecount 14, logstart 1, i 7),
old log /proj/sge/default/common/accounting.7.gz does not exist
renaming /proj/sge/default/common/accounting.6.gz to /proj/sge/default/common/accounting.7.gz (rotatecount 14, logstart 1, i 6),
old log /proj/sge/default/common/accounting.6.gz does not exist
renaming /proj/sge/default/common/accounting.5.gz to /proj/sge/default/common/accounting.6.gz (rotatecount 14, logstart 1, i 5),
old log /proj/sge/default/common/accounting.5.gz does not exist
renaming /proj/sge/default/common/accounting.4.gz to /proj/sge/default/common/accounting.5.gz (rotatecount 14, logstart 1, i 4),
old log /proj/sge/default/common/accounting.4.gz does not exist
renaming /proj/sge/default/common/accounting.3.gz to /proj/sge/default/common/accounting.4.gz (rotatecount 14, logstart 1, i 3),
old log /proj/sge/default/common/accounting.3.gz does not exist
renaming /proj/sge/default/common/accounting.2.gz to /proj/sge/default/common/accounting.3.gz (rotatecount 14, logstart 1, i 2),
old log /proj/sge/default/common/accounting.2.gz does not exist
renaming /proj/sge/default/common/accounting.1.gz to /proj/sge/default/common/accounting.2.gz (rotatecount 14, logstart 1, i 1),
old log /proj/sge/default/common/accounting.1.gz does not exist
renaming /proj/sge/default/common/accounting.0.gz to /proj/sge/default/common/accounting.1.gz (rotatecount 14, logstart 1, i 0),
old log /proj/sge/default/common/accounting.0.gz does not exist
log /proj/sge/default/common/accounting.15.gz doesn't exist -- won't try to dispose of it
renaming /proj/sge/default/common/accounting to /proj/sge/default/common/accounting.1
compressing log with: /bin/gzip
error: error setting owner of /proj/sge/default/common/accounting.1.gz: Invalid argument

rotating pattern: /proj/sge/default/spool/*/messages  forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
considering log /proj/sge/default/spool/*/messages
  log /proj/sge/default/spool/*/messages does not exist -- skipping

rotating pattern: /proj/sge/default/common/reporting  forced from command line (5 rotations)
empty log files are not rotated, old logs are removed
considering log /proj/sge/default/common/reporting
  log needs rotating
rotating log /proj/sge/default/common/reporting, log->rotateCount is 5
dateext suffix '-20120720'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
renaming /proj/sge/default/common/reporting.5.gz to /proj/sge/default/common/reporting.6.gz (rotatecount 5, logstart 1, i 5),
old log /proj/sge/default/common/reporting.5.gz does not exist
renaming /proj/sge/default/common/reporting.4.gz to /proj/sge/default/common/reporting.5.gz (rotatecount 5, logstart 1, i 4),
old log /proj/sge/default/common/reporting.4.gz does not exist
renaming /proj/sge/default/common/reporting.3.gz to /proj/sge/default/common/reporting.4.gz (rotatecount 5, logstart 1, i 3),
old log /proj/sge/default/common/reporting.3.gz does not exist
renaming /proj/sge/default/common/reporting.2.gz to /proj/sge/default/common/reporting.3.gz (rotatecount 5, logstart 1, i 2),
old log /proj/sge/default/common/reporting.2.gz does not exist
renaming /proj/sge/default/common/reporting.1.gz to /proj/sge/default/common/reporting.2.gz (rotatecount 5, logstart 1, i 1),
old log /proj/sge/default/common/reporting.1.gz does not exist
renaming /proj/sge/default/common/reporting.0.gz to /proj/sge/default/common/reporting.1.gz (rotatecount 5, logstart 1, i 0),
old log /proj/sge/default/common/reporting.0.gz does not exist
log /proj/sge/default/common/reporting.6.gz doesn't exist -- won't try to dispose of it
renaming /proj/sge/default/common/reporting to /proj/sge/default/common/reporting.1
compressing log with: /bin/gzip
error: error setting owner of /proj/sge/default/common/reporting.1.gz: Invalid argument

[root@dorado projects]# ls -l /proj/sge/default/common/reporting*
-rw-r--r-- 1 localmgr localmgr 237486 Jul 20 11:32 /proj/sge/default/common/reporting.1

Comment 7 Jan Kaluža 2012-07-20 11:10:00 UTC
Thank you very much. I'm able to reproduce it and will attach patch to fix this issue here soon. However, it shows the same error for me even with logrotate in rhel-5.8.

error: error setting owner of /proj/sge/default/common/reporting.1.gz: Invalid argument

Comment 8 Ondrej Valousek 2012-07-20 12:40:20 UTC
Ok, for me it worked with RHEL 5.8 (using NFSv3 - did not test v4 though).
Will the fix find its way into U4 please?
Thanks

Comment 9 Jan Kaluža 2012-07-23 07:58:48 UTC
I think it's caused by different NFS settings. The problem is that logrotate tries to change the owner of "reporting.1.gz" according to original "reporting" log file. This behaviour is in logrotate in RHEL6 and also in RHEL5. But on your NFSv4 configuration, it's not able to change the owner so it fails to rotate that particular log.

It's the same like when you run for example "chmod nobody:nobody /proj/sge/default/common/reporting". That command will fail for your NFS too probably.

Patch I will attach right after this message fixes this behaviour. With this patch, logrotate checks the "reporting.1.gz" owner and if it's right, it won't even try to change it. This fixed the bug for me.

Comment 10 Jan Kaluža 2012-07-23 08:00:23 UTC
Upstream patch: https://fedorahosted.org/logrotate/changeset/377

Comment 19 errata-xmlrpc 2013-07-18 09:34:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1095.html


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