I've specific problem with logrotate which is rotating before reaches the limit - set by maxsize
logrotate version - 3.8.6I'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.gzNow:
8632827 Sep 9 12:56 access_logThe 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.gzCan sb tell me what is wrong? Why are logs rotated before size limit? Thanks
21 Answer
In the logrotate manual page there is no "maxsize" option, just "size" and "minsize".
From
If you change "maxsize" to "size" I'm sure it will work!
1