3

I've specific problem with logrotate which is rotating before reaches the limit - set by maxsize

logrotate version - 3.8.6

I've a custom logrotate file

/var/web/log/access_log
{
    rotate 40
    maxsize 200M
    missingok
    compress
}

and logrotate is set in crontab without -f and rotate logs almost every hour despite it did not reach the maxsize listed below (logs are rotated with few MBs):

 95642 Sep  8 08:29 access_log.2020-09-08_08.gz
 86705 Sep  8 09:29 access_log.2020-09-08_09.gz
 70344 Sep  8 09:59 access_log.2020-09-08_10.gz
 86491 Sep  8 10:59 access_log.2020-09-08_11.gz
117124 Sep  8 11:59 access_log.2020-09-08_12.gz
106386 Sep  8 12:59 access_log.2020-09-08_13.gz
113683 Sep  8 13:59 access_log.2020-09-08_14.gz
104494 Sep  8 15:29 access_log.2020-09-08_15.gz
 99380 Sep  8 17:00 access_log.2020-09-08_17.gz
 87250 Sep  8 19:30 access_log.2020-09-08_19.gz

Now:

8632827 Sep  9 12:56 access_log

The output:

empty log files are rotated, log files >= 209715200 are rotated earlier, old logs are removed
considering log /var/web/log/access_log
  log needs rotating

... Sep  9 13:00 access_log.2020-09-09_13.gz

Can sb tell me what is wrong? Why are logs rotated before size limit? Thanks

3
  • did you reload logrotate or cron service?
    – Dagelf
    Commented Sep 22, 2020 at 16:20
  • Of course, before I started mess up with max size I had one log per day (daily rotation...) Now as you can see, logs are rotated more frequently, which confirms logrotate reload... Also I've updated cron service to commit every 30 minutes
    – Geo Fery
    Commented Sep 24, 2020 at 10:01
  • Deb/Ubuntu do have a maxsize, so the accepted answer is wrong. Your problem is caused by an interaction of the settings of the cron period, and whatever you specified as the rotate period in your config file.
    – EML
    Commented Jun 23, 2022 at 12:02

1 Answer 1

2

In the logrotate manual page there is no "maxsize" option, just "size" and "minsize".

enter image description here

enter image description here

From https://linux.die.net/man/8/logrotate

If you change "maxsize" to "size" I'm sure it will work!

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .