This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 841520 - logrotate is unable to compress log files on NFS mounted directory
logrotate is unable to compress log files on NFS mounted directory
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: logrotate (Show other bugs)
6.4
All Linux
unspecified Severity low
: rc
: ---
Assigned To: Jan Kaluža
Tomas Dolezal
:
Depends On:
Blocks: 841837
  Show dependency treegraph
 
Reported: 2012-07-19 05:41 EDT by Ondrej Valousek
Modified: 2013-07-18 20:16 EDT (History)
3 users (show)

See Also:
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).
Story Points: ---
Clone Of:
: 841837 (view as bug list)
Environment:
Last Closed: 2013-07-18 05:34:56 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ondrej Valousek 2012-07-19 05:41:06 EDT
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 06:03:19 EDT
also note that same settings work fine on RHEL 5.8
Comment 3 Jan Kaluža 2012-07-19 06:11:44 EDT
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 08:52:05 EDT
[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 14:55:39 EDT
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 05:39:41 EDT
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 07:10:00 EDT
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 08:40:20 EDT
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 03:58:48 EDT
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 04:00:23 EDT
Upstream patch: https://fedorahosted.org/logrotate/changeset/377
Comment 19 errata-xmlrpc 2013-07-18 05:34:56 EDT
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.