Manjaro Difference between revisions of "Limit the size of .log files & the journal"

Difference between revisions of "Limit the size of .log files & the journal"

From Manjaro
imported>Handy
imported>Handy
Line 237: Line 237:


<br clear="all"/>
<br clear="all"/>
== Stop runaway errors from devouring your drive space ==
Note: The following is still being tested.
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=


Cookies help us deliver our services. By using our services, you agree to our use of cookies.