Public bug reported:

Over the last few Ubuntu releases, the status file the logrotate
generates and uses has been adding more and more detailed time stamp
information.

In 12.04 it seems to only keep information to the day.
In 14.04 it seems to only keep information to the hour.
In 16.04 it seems to keep information to the second.

However, the weekly section of the logrotate program calculates the time
since the last rotation to the second with absolutely no jitter margin,
and therefore as often as every other week, weekly logs that should
rotate on Sunday do not rotate until Monday. I have 43 weeks of weekly
rotation data, where on 17 of those weeks the rotation was on Monday and
not Sunday. Note that the week after Monday rotation it will always
rotate on Sunday due to "the current weekday is before the weekday of
the last rotation" condition.

Code segment:

        case ROT_WEEKLY:
            /* rotate if:
               1) the current weekday is before the weekday of the
               last rotation
               2) more then a week has passed since the last
               rotation */
            state->doRotate = ((now.tm_wday < state->lastRotated.tm_wday)
                               ||
                               ((mktime(&now) -
                                 mktime(&state->lastRotated)) >
                                (7 * 24 * 3600)));

There is an upstream bug report at: 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825776
which I will attempt to link in. It suggests introducing a 60 jitter allowance. 
I would make it more myself.

I first noticed this issue during 16.04 development in 2016.02 (Feb).
See also: https://ubuntuforums.org/showthread.php?t=2320149

Do not ask me to run apport collect for this bug report, because it is
not needed, and it never works for me anyhow.

** Affects: logrotate (Ubuntu)
     Importance: Undecided
         Status: New

** Summary changed:

- weekly log roation is often a day late
+ weekly log rotation is often a day late

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1649168

Title:
  weekly log rotation is often a day late

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/logrotate/+bug/1649168/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to