Administering Evergreen Logs

Particularly if you have set debugging to a highly verbose level, like INFO or DEBUG, the Evergreen logs can quickly take up a significant amount of disk space. Fortunately, this is not a new problem for Unix administrators, and there are a number of ways of keeping your logs under control. On Debian and Ubuntu, for example, the logrotate utility controls when old log files are compressed and a new log file is started. logrotate runs once a day and checks all log files that it knows about to see if a threshold of time or size has been reached and rotates the log files if a threshold condition has been met.

To teach logrotate to rotate Evergreen logs on a weekly basis, or if they are > 50MB in size, create a new file /etc/logrotate.d/evergreen with the following contents:

compress
/openils/var/log/*.log {
  # keep the last 4 archived log files along with the current log file
  #   log log.1.gz log.2.gz log.3.gz log.4.gz
  # and delete the oldest log file (what would have been log.5.gz)
  rotate 5

  # if the log file is > 50MB in size, rotate it immediately
  size 50M

  # for those logs that don't grow fast, rotate them weekly anyway
  weekly
}