Bug 723570 - logrotate configurations "size" and "yearly" should not be combined
Summary: logrotate configurations "size" and "yearly" should not be combined
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: yum
Version: 15
Hardware: All
OS: All
unspecified
low
Target Milestone: ---
Assignee: Fedora Packaging Toolset Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-20 15:34 UTC by Göran Uddeborg
Modified: 2014-01-21 23:18 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-07 17:58:48 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Göran Uddeborg 2011-07-20 15:34:13 UTC
According to the logrotate documentation, the "size" and time specifications like "yearly" are mutually exclusive.  (Currently there is a bug in the parsing of "size" which makes it to be interpreted as "minsize" instead, see bug 723547.)  The logrotate configuration for "yum" contains both "size 30k" and "yearly".

Is the intention to rotate yearly, but only if the size is more than 30 kB?  Then "minsize" should be used instead of "size".

Is the intention to just rotate yearly?  Then "size" should be removed.  And vice versa, if the intention is to rotate whenever the file grows larger than 30 kB.

Maybe the intention is to rotate when EITHER a year has passed or the file is larger than 30 kB.  As I understand it, that possibility is not currently supported by logrotate.

Comment 1 James Antill 2011-07-20 21:26:30 UTC
> Maybe the intention is to rotate when EITHER a year has passed or the file is
> larger than 30 kB.  As I understand it, that possibility is not currently
> supported by logrotate.

This was the intention (and it worked, AFAIK). Specifically we used just "size = 30k", but then people complained about it not rotating every year (because the syslog format doesn't include years -- so it would become confusing).

Comment 2 Michael Schwendt 2011-07-20 21:37:18 UTC
It cannot work like that, because the logrotate source code does not implement it like that. It is an if-else in the code, an either "size" or "yearly", and latest option in the config file wins:

The manual comments on that in several ways:

| [...] later  definitions  override  earlier  ones)

And on how "size" is special:

|      minsize size
|             Log files are rotated when they grow bigger than size bytes, but
|             not before the  additionally  specified  time  interval  (daily,
|             weekly, monthly, or yearly).
|
|             The related size option is similar
|             except that it is mutually  exclusive  with  the  time  interval
|             options,  and  it  causes log files to be rotated without regard
|             for the last rotation time.  When minsize is used, both the size
|             and timestamp of a log file are considered.

Comment 3 Michael Schwendt 2011-07-20 21:50:55 UTC
Also, repeating the debug mode example:


$ logrotate -d /etc/logrotate.d/yum 
reading config file /etc/logrotate.d/yum

Handling 1 logs

rotating pattern: /var/log/yum.log  yearly (no old logs will be kept)
empty log files are not rotated, only log files >= 30720 bytes are rotated, old logs are removed
considering log /var/log/yum.log
  log does not need rotating

$ ls -hs /var/log/yum.log 
120K /var/log/yum.log



And for comparison, with an old logrotate-3.7.8-12.fc14 that doesn't suffer from bug 723547 and doesn't parse "size" as "minsize" by mistake:


$ logrotate -d /etc/logrotate.d/yum 
reading config file /etc/logrotate.d/yum
reading config info for /var/log/yum.log 

Handling 1 logs

rotating pattern: /var/log/yum.log  yearly (no old logs will be kept)
empty log files are not rotated, old logs are removed
considering log /var/log/yum.log
  log does not need rotating

$ ls -hs /var/log/yum.log 
120K /var/log/yum.log


In other words, currently, it only rotates yearly.

Comment 4 Göran Uddeborg 2011-07-21 07:55:52 UTC
Michael already answered for me while I was asleep, so I'll add this little comment to clear the needinfo flag.

And FYI: I just filed bug 727797 with a suggestion to add support to logrotate for what you want to do.  But obviously, that is for the future, it won't work now.

Comment 5 Fedora Admin XMLRPC Client 2012-04-27 15:40:02 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 6 Fedora End Of Life 2012-08-07 17:58:51 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping


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