logrotate_mtx.conf File
Use the logrotate_mtx.conf file to configure system log rotation behavior. By default, the log volume is checked on a daily basis to determine if log rotation is needed, based on the settings defined in this file.
In Kubernetes, the logrotate_mtx.conf file configures log rotation behavior only for MATRIXX Engine and the logrotate_tra.conf file configures TRA log rotation. For information, see the discussion about logrotate_tra.conf file.
MTX logrotate_mtx.conf File
The following example logrotate_mtx.conf file shows the default values for MATRIXX Engine log rotation. It describes the values set for the system log, debug log, command log, and process control log.
Depending on your workload and the log level configured for your system, you can change the rotation period and the log file volume in these files. Typically, you need not change any other parameter values.
After specifying the configuration parameters, copy this file from the /opt/mtx/data directory to the /etc/logrotate.d/mtx directory. For more information about the configuring log rotation, see the discussion about configuring log rotation.
#
# /etc/logrotate.d/mtx
#
# This is a sample logrotate configuration for mtx.
#
# The default configuration for mtx.log will
# (1) Rotate 30 times before being removed.
# (2) The log file is created immediately after rotation (before the
# postrotate script is run).
# (3) Log files are rotated every day.
# (4) If the log file is missing, go on to the next one without an error.
# (5) Do not rotate the log if it is empty.
# (6) Old versions of log files are compressed with gzip.
# (7) Postpone compression of the previous log file to the next rotation
# cycle.
# (8) Log file is rotated when it grows bigger than 100M.
# (9) Reload rsyslog to create a new mtx.log file and file permission
# of mtx.log file to be readable by 'mtx' user after the log file is
# rotated.
#
# The default configuration for mtx_cmd.log will
# (1) Rotate 7 times before being removed.
# (2) The original log file is truncated to zero size in place after
# creating a copy. Note: There is a very small time slice between
# copying the file and truncating it, so some logging data might be
# lost.
# (3) Log files are rotated every day.
# (4) If the log file is missing, go on to the next one without an error.
# (5) Do not rotate the log if it is empty.
# (6) Old versions of log files are not compressed.
# (7) Log file is rotated when it grows bigger than 100M.
#
# The default configuration for mtx_debug.log will
# (1) Rotate 7 times before being removed.
# (2) The log file is created immediately after rotation (before the
# postrotate script is run).
# (3) Log files are rotated every day.
# (4) If the log file is missing, go on to the next one without an error.
# (5) Do not rotate the log if it is empty.
# (6) Old versions of log files are not compressed.
# (7) Log file is rotated when it grows bigger than 500M.
# (8) Send USR2 signal to mtx servers so that it can start using new log
# log file after the log file is rotated.
#
# The default configuration for mtx_process_ctrl.log will
# (1) Rotate 30 times before being removed.
# (2) The original log file is truncated to zero size in place after
# creating a copy. Note: There is a very small time slice between
# copying the file and truncating it, so some logging data might be
# lost.
# (3) Log files are rotated every day.
# (4) If the log file is missing, go on to the next one without an error.
# (5) Do not rotate the log if it is empty.
# (6) Old versions of log files are compressed with gzip.
# (7) Postpone compression of the previous log file to the next rotation
# cycle.
# (8) Log file is rotated when it grows bigger than 100M.
# (9) Change file permission of mtx_process_ctrl.log file to be readable by
# 'mtx' user after the log file is rotated.
#
# Note: Do the following to allow mtx.log file rotation, which requires
# 'root' privileges.
# (1) copy and rename this file to /etc/logrotate.d/mtx (i.e.
# 'cp logrotate_mtx.conf /etc/logrotate.d/mtx')
# (2) [Optional] If need to check log file size more often than daily,
# copy and rename cron-hourly-logrotate-mtx to
# /etc/cron.hourly/logrotate-mtx (i.e. 'cp cron-hourly-logrotate-mtx
# /etc/cron.hourly/logrotate-mtx')
# (3) restart cron service (i.e. 'systemctl restart crond' on RedHat 7)
#
# Note: [Optional] Log files can be offloaded at the postrotate step.
#
#
# The path for mtx.log must match with the value specified in
# /etc/rsyslog.d/20-mtx.conf file.
#
/var/log/mtx/mtx.log "mtx.log"
{
rotate 30
create
daily
missingok
notifempty
compress
delaycompress
maxsize 100M
sharedscripts
dateext
dateformat _%Y_%m_%d_%H_%s
extension .log
postrotate
/etc/init.d/rsyslog reload >/dev/null 2>&1 || true
chmod 644 /var/log/mtx/mtx.log
endscript
}
#
/var/log/mtx/mtx_cmd.log "mtx_cmd.log"
{
rotate 7
copytruncate
daily
missingok
notifempty
nocompress
maxsize 100M
sharedscripts
dateext
dateformat _%Y_%m_%d_%H_%s
extension .log
postrotate
chmod 644 /var/log/mtx/mtx_cmd.log
endscript
}
#
# The path for mtx_debug.log must match with the value specified inside of
# <log_file_name> in mtx_config.xml file.
#
/var/log/mtx/mtx_debug.log "mtx_debug.log"
{
rotate 7
create
daily
missingok
notifempty
nocompress
maxsize 500M
sharedscripts
dateext
dateformat _%Y_%m_%d_%H_%s
extension .log
postrotate
if killall -q -s0 -umtx mtx; then
killall -q -USR2 -umtx mtx
fi
endscript
}
#
# The path for mtx_process_ctrl.log must match with the value specified in
# /etc/rsyslog.d/20-mtx.conf file.
#
/var/log/mtx/mtx_process_ctrl.log "mtx_process_ctrl.log"
{
rotate 30
copytruncate
daily
missingok
notifempty
compress
delaycompress
maxsize 100M
sharedscripts
dateext
dateformat _%Y_%m_%d_%H_%s
extension .log
postrotate
chmod 644 /var/log/mtx/mtx_process_ctrl.log
endscript
}