Symptoms
As Provider I want to rotate POA logs on the Linux-based POA Management Node after the logs reach a certain size.
Resolution
POA for Linux is using the native Linux logrotate utility to rotate own logs.
The rotation settings for the log files /var/log/poa.log and /var/log/poa.debug.log on the POA Management Node are configured in the /etc/logrotate.d/syslog file, the default settings are as follows:
/var/log/poa.log {
rotate 28
daily
compress
dateext
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
/var/log/poa.debug.log {
rotate 14
daily
compress
dateext
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
You may configure log rotation by size - add the following line to the corresponding section (poa.log or poa.debug.log) in the /etc/logrotate.d/syslog file on the POA Management Node:
size=<size in megabytes>M
Here is the example of the resulting file for rotating logs when they grow bigger than 1024 MB:
/var/log/poa.log {
rotate 28
size 1024M
daily
compress
dateext
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
/var/log/poa.debug.log {
rotate 14
size 1024M
daily
compress
dateext
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
Yoy may also configure the same parameters for additional POA logs in the /etc/logrotate.d/poa file on the POA Management Node.
No need to restart any services after changing the log rotation configuration files.
Refer to the man page for the logrotate utility for more information about the log rotation parameters.