Bug 1266210 - /etc/logrotate.d/glusterfs improperly modifies global logrotate settings
/etc/logrotate.d/glusterfs improperly modifies global logrotate settings
Status: CLOSED DUPLICATE of bug 1171865
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: glusterfs (Show other bugs)
6.7
Unspecified Unspecified
urgent Severity urgent
: rc
: ---
Assigned To: Bala.FA
Sudhir D
: EasyFix
Depends On:
Blocks: 1266214
  Show dependency treegraph
 
Reported: 2015-09-24 15:13 EDT by Ryan Sawhill
Modified: 2015-11-22 21:59 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1266214 (view as bug list)
Environment:
Last Closed: 2015-09-24 16:13:51 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 Ryan Sawhill 2015-09-24 15:13:08 EDT
Description of problem:

glusterfs provides /etc/logrotate.d/glusterfs which configures logrotate to rotate /var/log/glusterfs/*.log and /var/log/glusterfs/bricks/*.log files.

Unfortunately it has six directives which are improperly unbounded by brackets.

  [rsaw logrotate.d]$ cat glusterfs
  # perform the log rotate every week
  weekly
  # keep the backup of 52 weeks
  rotate 52
  missingok

  # compress the logs, but from the .2 onwards
  compress
  delaycompress
  notifempty

  # Rotate client logs
  /var/log/glusterfs/*.log {
    sharedscripts
    postrotate
    /usr/bin/killall -HUP glusterfs > /dev/null 2>&1 || true
    /usr/bin/killall -HUP glusterd > /dev/null 2>&1 || true
    endscript
  }

  # Rotate server logs
  /var/log/glusterfs/bricks/*.log {
    sharedscripts
    postrotate
    /usr/bin/killall -HUP glusterfsd > /dev/null 2>&1 || true
    endscript
  }

To be clear, the above modifies the global logrotate config, MAKING IT SO THAT ALL OTHER LOG FILES ON THE SYSTEM will be rotated weekly, compressed, and kept for 52 weeks.


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

I checked the latest version available in standard repos: glusterfs-3.6.0.54-1.el6


How reproducible:

100%


Steps to Reproduce:

1. Install glusterfs package
2. Open /etc/logrotate.d/glusterfs
3. Ponder.


Expected results:

The file could instead look like this.

  # Rotate client & server logs
  /var/log/glusterfs/*.log
  /var/log/glusterfs/bricks/*.log
  {
    # perform the log rotate every week
    weekly
    # keep the backup of 52 weeks
    rotate 52
    missingok
    # compress the logs, but from the .2 onwards
    compress
    delaycompress
    notifempty
    sharedscripts
    postrotate
    /usr/bin/killall -HUP glusterfs > /dev/null 2>&1 || true
    /usr/bin/killall -HUP glusterd > /dev/null 2>&1 || true
    /usr/bin/killall -HUP glusterfsd > /dev/null 2>&1 || true
    endscript
  }

# Rotate server logs
/var/log/glusterfs/bricks/*.log {
  sharedscripts
  postrotate
  endscript
}


Additional info:

I noticed this by looking at an strace of logrotate and seeing "(52 rotations)" for EVERY pattern. E.g.,

  write(2, "\nrotating pattern: /var/log/cron\n/var/log/maillog\n/var/log/messages\n/var/log/secure\n/var/log/spooler\n ", 102)
  write(2, "weekly ", 7)
  write(2, "(52 rotations)\n", 15)

Of course the above was on a system where the above pattern of files was managed by /etc/logrotate.d/syslog which had no customizations and thus that "52" there should have instead said "7" since /etc/logrotate.conf was also default.
Comment 1 Ryan Sawhill 2015-09-24 15:18:37 EDT
Ah. Made a small mistake in my previous comment:

The file could instead look like this.

  # Rotate client & server logs
  /var/log/glusterfs/*.log
  /var/log/glusterfs/bricks/*.log
  {
    # perform the log rotate every week
    weekly
    # keep the backup of 52 weeks
    rotate 52
    missingok
    # compress the logs, but from the .2 onwards
    compress
    delaycompress
    notifempty
    sharedscripts
    postrotate
    /usr/bin/killall -HUP glusterfs > /dev/null 2>&1 || true
    /usr/bin/killall -HUP glusterd > /dev/null 2>&1 || true
    /usr/bin/killall -HUP glusterfsd > /dev/null 2>&1 || true
    endscript
  }
Comment 2 Ryan Sawhill 2015-09-24 16:13:51 EDT

*** This bug has been marked as a duplicate of bug 1171865 ***

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