Managing Log Files

Evergreen comes with a sophisticated logging system, but it is important to manage the OpenSRF and Evergreen logs. This section will provide a couple of log management techniques and tools.

Using the logrotate Utility to Manage Log Size

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
}

Changing Logging Level for Evergreen

Change the Log Levels in your config files. Changing the level of logging will help narrow down errors.

Tip

A high logging level is not wise to do in a production environment since it will produce vastly larger log files and thus reduce server performance.

Change logging levels by editing the configuration file /openils/conf/opensrf_core.xml

you will want to search for lines containing <loglevel>.

the default setting for loglevel is 3 which will log errors, warnings and information.

The next level is 4 which is for debugging and provides additional information helpful for the debugging process.

Thus, lines with:

<loglevel>3</loglevel>

Should be changed to:

<loglevel>4</loglevel>

to allow debugging level logging

Other logging levels include 0 for no logging, 1 for logging errors and 2 for logging warnings and errors.