logrotate by size outside the daily schedule
Posted
by
Josh Smeaton
on Server Fault
See other posts from Server Fault
or by Josh Smeaton
Published on 2013-11-02T23:40:32Z
Indexed on
2013/11/03
3:56 UTC
Read the original article
Hit count: 359
We have a couple of applications that generate huge log files. It's not enough to rotate those logs daily, so I created the following logrotate conf:
/var/log/ourapp/*log {
compress
copytruncate
missingok
size 200M
rotate 10
}
The idea is that we can keep 2GB of logs for this one application, no matter how quickly those files are filling up. The problem, though, is that logrotate only runs once daily. AFAIK, when logrotate kicks off at 4am, it will check to see that the size is at least 200M and rotate it if so.
Ideally logrotate would run every minute, check the size, and rotate if the size is greater. Is there a standard way for rotating based on size outside of the daily cron schedule?
© Server Fault or respective owner