logrotate by size outside the daily schedule
- by Josh Smeaton
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?