Sophos

Online support

Product maintenance

Contact support

Support services

PureMessage for UNIX: rotating log files

PureMessage for UNIX log files must be periodically cleared to avoid using too much disk space. PureMessage for UNIX includes a sample configuration file, logrotate.conf. This can be used to set the parameters for 'rotating' (i.e., archiving) the contents of the PureMessage log files.

The logrotate utility is a standard Linux component. It is also available for other UNIX platforms.

What to do

These notes provide a generic example of how to use logrotate. Adapt them to suit your environment and operating system. Refer to your operating system documentation for more information about logrotate. Log rotation is a standard maintenance task on UNIX systems, and is therefore outside the realm of PureMessage support.

Logrotate usually runs as a daily cron job in /etc/cron.daily. It can also be configured to run at set times, or when logs reach a specified size. Log rotation frequency depends on the volume of processed mail and reporting requirements (archived data from log files is no longer included in PureMessage's pre-defined reports).

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:

You can specify frequency and backlog settings globally in the logrotate.conf file, or individually for each log file in the sample pmx_log and message_log configuration files. The logrotate documentation for your operating system will include information about parameters.

Running logrotate as a scheduled job

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>

Specifying a state file

On some platforms, the default location of the state file for the system will be in a directory for which the PureMessage user has no rights. If so, specify an alternate state file, by inserting the following string in the logrotate command (before the specification of the .conf file):

-s opr/pmx/var/log/logrotate.state

    If you need more information or guidance, then please contact technical support.