How to Refine the Log Retention Settings in XenServer
Summary
This article describes how to refine the logging configuration on XenServer.
Requirements
You must have console access to a XenServer either through the local console, XenCenter, or SSH.
Background
If the log size of the host is increasing to a larger size, you can consider refining the logging configuration on XenServer by completing the following procedure.
Remember that this procedure must be completed on each individual XenServer host. These configuration changes do not propagate between hosts in a pool.
Procedure
To verify the used space on log directory, run the following command on the XenServer host console:
# du –h /var/log
Following is a sample output of the preceding command:
In the preceding sample, the sum of all the logs in /var/log is 84MB. If the size of this directory approaches 1GB, the log configuration requires refining.
The following three methods are recommended for restraining the increase of the size of the log files in this directory.
- Run logrotate hourly instead of daily. Run the following command from the XenServer host console:
# mv /etc/cron.daily/logrotate.conf /etc/cron.hourly/logrotate.conf
Advanced cron scheduling can be used in some scenarios.
- Compress old logs. To compress the old log files use the VI to edit the logrotate.conf file. In the /etc/logrotate.conf file, remove the comment from the following line:
#compress
- Retain fewer historical logs.
By default XenServer retains 20 historical logs. This can be reduced by changing the numeric value in the following line:
rotate 20
Note that any logs above this threshold value are not be managed by the logroate file and will need to be removed manually.
- Run logrotate hourly instead of daily. Run the following command from the XenServer host console: