Managing Your Logs with logrotate

Having these logging technologies is great for accessing the information at your fingertips, but a time will come when you do not need the logs in their original form and would like to archive them off. This can be handled manually, but if you have a large number of logs, automation is the way to go.

Logs, left to their own devices, especially those on a large active system, can run riot with your disk space. The logrotate application can automate the management of log files by copying and archiving them based on rules.

SUSE includes logrotate scripts for most active logging processes, and these can be found in /etc/logrotate.d. The directory contains a logrotate configuration file for each process logrotate manages. The main configuration file for logrotate is /etc/logrotate.conf and contains archiving defaults as well as an entry to link all of the configuration files for logrotate-aware applications.

Any files located in /etc/logrotate.d will be opened and interpreted as logrotate directives when logrotate is executed.

logrotate is executed daily as one of the system jobs defined in the directory /etc/cron .daily/. The time at which these jobs are run can be defined using the variable DAILY_TIME in the file /etc/sysconfig/cron. The logrotate program loads the configuration files in /etc/logrotate.d and then decides if it needs to rotate any of the log files that it manages.

Was this article helpful?

0 0

Post a comment