ec_rotate

March 26, 2020 Contributors

Name

ec_rotate — rotate Momentum logfiles

Synopsis

/opt/msys/ecelerity/bin/ec_rotate [ -c | -compress ]

/opt/msys/ecelerity/bin/ec_rotate [ -conf /path/to/config_file ]

/opt/msys/ecelerity/bin/ec_rotate [ -d | -default ]

/opt/msys/ecelerity/bin/ec_rotate [ -l | -logfile /path/to/logfile ]

/opt/msys/ecelerity/bin/ec_rotate [ -logdir /path/to/dir ]

/opt/msys/ecelerity/bin/ec_rotate [ -n | -nocompress ]

/opt/msys/ecelerity/bin/ec_rotate [ -r | -retention number ]

/opt/msys/ecelerity/bin/ec_rotate [ -s | -socket /path/to/socket ]

/opt/msys/ecelerity/bin/ec_rotate [ -v ]

Description

The ec_rotate command is a utility script used to rotate and compress logs that Momentum writes.

Momentum opens its logfiles at startup and maintains an open filehandle to them throughout its life cycle. When you invoke ec_rotate, the mainlog.ec file is moved to mainlog.ec.1, Momentum is instructed to re-open its logfiles, and a new mainlog.ec file is created. Any other logfiles configured for rotation are treated in the same way. Unix file I/O semantics guarantee that no log lines will be lost between the time the file is moved and the logs are re-opened; they will simply appear in the older of the logs. To avoid the overhead of checking the logfile on every attempt, Momentum relies on the user to tell it when the logfile needs to be re-opened.

The ec_rotate.conf file specifies the configuration for this command. By default, ec_rotate controls log file rotation for the following files, compresses these files using bzip, and keeps seven days of logs on disk:

  • /var/log/ecelerity/mainlog.ec

  • /var/log/ecelerity/paniclog.ec

  • /var/log/ecelerity/rejectlog.ec

  • /var/log/ecelerity/bouncelog.ec

  • /var/log/ecelerity/acctlog.ec

  • /var/log/ecelerity/smpplog.ec

  • /var/log/ecelerity/ecconfigd.log

  • /var/log/ecelerity/httplog.ec

  • /var/ecconfigd/apache/access.log

  • /var/ecconfigd/apache/error.log

  • /var/log/ecelerity/adaptive

Note

The ec_rotate script is hardcoded to rotate the files named above. You only need to change the default ec_rotate.conf file if you wish to change the location of these files, if you wish to rotate additional files, or if you wish to change the retention period. See “ec_rotate.conf”.

The following options change the behavor of the ec_rotate command:

-c, -compress *`/path/to/utility`*

Specify the full path to the compression utility to use for compressing logfiles. Default is /usr/bin/bzip2, but /usr/bin/gzip can also be used.

-conf *`/path/to/file`*

Specify a configuration file for ec_rotate to use. Default is ec_rotate.conf.

-d, -default

If this option is specified, the script will first try to find the configuration file at /opt/msys/ecelerity/etc/ec_rotate.conf. If this file exists, it will use it as the configuration file. This option has the same effects as -conf /opt/msys/ecelerity/etc/ec_rotate.conf. Otherwise, files at their default locations will be rotated. For more information about the ec_rotate.conf file see ec_rotate.conf File”.

-l, -logfile *`/path/to/file`*

Specify the logfile(s) to be rotated. May be specified multiple times to handle multiple logs. Logs generated by any of the Momentum’s logging modules can be specified for rotation using this option.

-logdir *`/path/to/dir`*

Specify the log directories to be searched and rotate files with the suffix .log. Like the logfile option, this option may be specified multiple times to handle multiple directories.

-n, -nocompress

Do not compress files while rotating.

-r, -retention *`number`*

Specify the maximum number of logs to keep on disk. Default is 7.

-s, -socket *`/path/to/socket`*

Specify path to the Control_Listener socket.

The following is an example in which the logfiles are in /var/log/email/ and 3 days are kept:

/opt/msys/ecelerity/bin/ec_rotate -l /var/log/email/mainlog.ec \
  -l /var/log/email/paniclog.ec -r 3