When using the size specifier with logrotate, are the files rotated as soon as the size gets bigger than what is specified, or does it rotate when it is run from the cron and the size is bigger than what is specified?


It happens when it logrotate is run from cron (normally daily).


The "size" parameter is taken into consideration whenever you run logrotate. Whether or not you're running it through an automated system like cron/anacron, that is up to you; you can execute it manually without such automated systems just as easily. Anytime that logrotate is executed, automated or otherwise, the logs in question will not be rotated until they are equal or greater than the size you specified, even if they have already crossed the time threshold you've specified. From man's definition of the size parameter:

Log files are rotated only if they grow bigger then size bytes. If size is followed by k, the size is assumed to be in kilobytes. If the M is used, the size is in megabytes, and if G is used, the size is in gigabytes. So size 100, size 100k, size 100M and size 100G are all valid.


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.