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

    rotate 40
    maxsize 200M

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


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

  • did you reload logrotate or cron service? – Dagelf Sep 22 '20 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 Sep 24 '20 at 10:01

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!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.