Rotating PureMessage Log Files

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.

Note: This section provides a generic example of using logrotate. Alter these instructions as necessary to suit your environment and operating system. Refer to your system's documentation for more information about the logrotate utility. Log rotation is a standard maintenance task on Unix systems, and is therefore beyond the scope of PureMessage Support.

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/pmx6/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/pmx6/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/pmx6/etc/logrotate.d' statement in the logrotate.conf file.

The logrotate.d directory contains configuration files for the following logs:

  • access_log: Records all actions performed via the PureMessage Manager (controls clicked, pages requested, etc). Location: /opt/pmx6/var/log/manager/.
  • activity_log: Records the activity of users and modules associated with the PureMessage Manager. Location: /opt/pmx6/var/log/
  • autovac_log: Records the actions of the pmx-pg-autovac program, which is used to maintain the states of database tables in memory. Location: /opt/pmx6/var/log/
  • blocklist_log: If MTA-level policy blocking is enabled, records the IP address of each message processed at the MTA level, along with the associated action. Location: /opt/pmx6/var/log/
  • error_log: Records any errors related to the operation of the PureMessage Manager. Location: /opt/pmx6/var/log/manager/
  • message_log: Records all messages that are processed by PureMessage. Contains both default and user-defined keys. This log is used primarily for reports. Location: /opt/pmx6/var/log/
  • pg.log: Records, by default, any abnormal database activity. Can also be configured to log additional data. Location: /opt/pmx6/postgres/
  • pmx_log: Records a variety of messages issued by pmx-milter, including debug, info, notice, warning, and error messages. Location: /opt/pmx6/var/log/
  • scheduler_log: Records the failure of any scheduled job. Optionally, both successes and failures are logged, and failure notifications can be sent to the administrator's email account. Location: /opt/pmx6/var/log/
  • vscan_log: If daemon-mode virus scanning is enabled, records all messages scanned for viruses. Location: /opt/pmx6/var/log/

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.

Running logrotate as a Scheduled Job

The logrotate utility can be run as a scheduled job owned by the PureMessage user (by default, "pmx6"). 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/pmx6/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/pmx6/etc/logrotate.conf'
     <when>
         s = 0
         m = 0
         h = 3
     </when>
   </event>

Specifying a State File

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/pmx6/var/log/logrotate.state