Difference between revisions of "Limit the size of .log files & the journal"
Views
Actions
Namespaces
Variants
Tools
Limit the size of .log files & the journal (view source)
Revision as of 13:31, 16 August 2013
, 11 years ago→The effect of running /etc/logrotate.d/rotate.logs everyday
imported>Handy |
imported>Handy |
||
Line 236: | Line 236: | ||
<br clear="all"/> | <br clear="all"/> | ||
== Stop runaway errors from devouring your drive space == | |||
The intention of this script is to catch a runaway repetitive error. | |||
I've created the following script that you place into '''/etc/cron.hourly''' | |||
/var/log/*log { | |||
hourly | |||
rotate 10 | |||
size 2M | |||
compress | |||
delaycompress | |||
copytruncate | |||
notifempty | |||
missingok | |||
postrotate | |||
mv /var/log/*.gz /var/log/old | |||
endscript | |||
} | |||
It is much the same as the script block used in the above example, except that it has '''rotate 10''' & most importantly it has the '''size 2M''' command. The '''size''' command takes precedence over the '''rotate''' command, so if any /var/log/*log file reaches a 2M file size inside of 24 hours it will be rotated. This size check happens every hour. | |||
=Support= | =Support= |