[Bug 1649168] Re: weekly log rotation is often a day late
Doug Smythies
1649168 at bugs.launchpad.net
Tue Dec 27 16:38:27 UTC 2016
** Description changed:
Over the last few Ubuntu releases, the status file the logrotate
- generates and uses has been adding more and more detailed time stamp
- information.
+ generates and uses has added more detail to the 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 14.04 it seems to keep information to the second.
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)));
+ 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
+ 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).
+ I first noticed this issue during 16.04 development in 2016.02 (Feb). However, that computer had previously been a 12.04 server, so I do not have good data about 14.04.
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.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to logrotate in Ubuntu.
https://bugs.launchpad.net/bugs/1649168
Title:
weekly log rotation is often a day late
Status in logrotate package in Ubuntu:
New
Bug description:
Over the last few Ubuntu releases, the status file the logrotate
generates and uses has added more detail to the time stamp
information.
In 12.04 it seems to only keep information to the day.
In 14.04 it seems to keep information to the second.
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). However, that computer had previously been a 12.04 server, so I do not have good data about 14.04.
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/logrotate/+bug/1649168/+subscriptions
More information about the foundations-bugs
mailing list