Public bug reported:

Binary package hint: logrotate

Ubuntu 9.04
logrotate: 3.7.7-3ubuntu1

When configuring logrotate like the following:

/var/log/mylogfile.log {
        compress
        missingok
        nomail
        rotate 99
        maxage 2
        size 1M
}

Having the log file's size that exceeds 1 MB and
a rotated log file mylogfile.3.log.gz with a timestamp

   1256119200 (Wed Oct 21 10:00:00 UTC 2009) and

consider local time to be

   1256317415 (Fri Oct 23 17:03:35 UTC 2009)

I would expect, that

   * logrotate deletes the rotated log file mylogfile.3.log.gz

It happens, that logrotate does not delete that file, since it
calculates like that

                if (!stat(oldName, &fst_buf)
                    && (((nowSecs - fst_buf.st_mtime) / 60 / 60 / 24)
                        > log->rotateAge)) {

In our case this calculation would give the result:

   2.294155

Since only integer values are used here, the value is automatically
trunctated to 2, which is not greater than the defined 'maxage'.

I attached a patch, that fixes this problem.

sandoz

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

-- 
logrotate deletes log files one day later than defined by 'maxage'
https://bugs.launchpad.net/bugs/459360
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

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

Reply via email to