PureMessage log files must be periodically cleared to avoid using too much disk space. PureMessage includes a sample configuration file, logrotate.conf, that can be used to set the parameters for "rotating" (that is, archiving) the contents of the PureMessage log files.
The logrotate utility is a standard component of Linux and is available for other Unix platforms.
Logrotate is commonly run as a daily cron job in /etc/cron.daily. However, it can be set to run according to whatever frequency suits your installation, or it can be configured to run when logs reach a specified size. The frequency of log rotation depends on the volume of mail your system processes and the amount of logged data you want to preserve (archived data from log files is no longer included in PureMessage's pre-defined reports).
The PureMessage log rotation parameters are determined by the configuration of the /opt/pmx/etc/logrotate.conf configuration file, and the parameters configured for individual PureMessage log files. Parameters for individual log files are stored by default in the /opt/pmx/etc/logrotate.d directory, and include a configuration file for both the system log (pmx_log) and the message log (message_log), among others. The log configuration files (pmx_log, etc) are imported into the (logrotate.conf) configuration via the 'include /opt/pmx/etc/logrotate.d' statement in the logrotate.conf file.
The logrotate.d directory contains configuration files for the following logs:
Frequency and backlog settings can be specified either globally in the logrotate.conf file or specifically for each log file. Refer to your system's logrotate documentation for information about parameters.
The logrotate utility can be run as a scheduled job owned by the PureMessage user (by default, "pmx"). In the PureMessage Manager, create a new scheduled job. Enter /path/to/logrotate for the command. Add a description, and use the scroll boxes to configure how often the logs will be rotated.
Alternatively, from the command line, create a file named pmx-logrotate.conf in /opt/pmx/etc/scheduler.d/, and add an <event logrotate> section. For example:
<event logrotate>
desc = "Rotate PureMessage Logs"
type = exec
action = '/usr/local/sbin/logrotate /opt/pmx/etc/logrotate.conf'
<when>
s = 0
m = 0
h = 3
</when>
</event>
On some platforms the default location of the system's state file is not located in a directory for which the PureMessage user has rights. In that case, specify an alternate state file by inserting the following string in the logrotate command (before the specification of the .conf file):
-s /opt/pmx/var/log/logrotate.state