Created a separated file for collectd logs

Collectd generates periodic logs indicating the platform CPU and
memory usage. When daemon.log rotates very quickly, only a few days of
history of these logs is available. If the logs are moved to a
separate file, a much longer history of platform resource usage will
be available regardless of how quickly daemon.log is rotated.

Defined collectd.log to keep only 10 files, still rotating when
reaching 10MB.

Closes-Bug: #1942263

Signed-off-by: Joao Paulo Tavares Musico <joaopaulotavares.musico@windriver.com>
Change-Id: Id1cdf58b5641abc105f41bbd910ca4ba1a1c55fe
This commit is contained in:
Joao Paulo Tavares Musico 2021-09-01 20:08:26 -04:00
parent 7c503a3033
commit af49353d91
2 changed files with 20 additions and 1 deletions

View File

@ -94,6 +94,7 @@ destination d_cron { file("/var/log/cron.log"); };
destination d_daemon { file("/var/log/daemon.log"); };
destination d_daemon_ocf { file("/var/log/daemon-ocf.log" template(t_ocf_log)); };
destination d_containerd { file("/var/log/containerd.log"); };
destination d_collectd { file("/var/log/collectd.log"); };
destination d_kern { file("/var/log/kern.log"); };
destination d_lpr { file("/var/log/lpr.log"); };
destination d_mail { file("/var/log/mail.log"); };
@ -212,9 +213,10 @@ filter f_messages { level(info,notice,warn) and
filter f_auth { facility(auth, authpriv) and not program("audispd"); };
filter f_cron { facility(cron); };
filter f_daemon { facility(daemon) and not program("containerd") and not program("^(OCF_).") and not match("snmp-auditor" value("MESSAGE")); };
filter f_daemon { facility(daemon) and not program("containerd") and not program("collectd") and not program("^(OCF_).") and not match("snmp-auditor" value("MESSAGE")); };
filter f_daemon_ocf { facility(daemon) and program("^(OCF_)."); };
filter f_containerd { facility(daemon) and program("containerd"); };
filter f_collectd { facility(daemon) and program("collectd"); };
filter f_kern { facility(kern); };
filter f_lpr { facility(lpr); };
filter f_local { facility(local0, local1, local3, local4, local5,
@ -293,6 +295,7 @@ log { source(s_src); filter(f_cron); destination(d_cron); };
log { source(s_src); filter(f_daemon); destination(d_daemon); };
log { source(s_src); filter(f_daemon_ocf); destination(d_daemon_ocf); };
log { source(s_src); filter(f_containerd); destination(d_containerd); };
log { source(s_src); filter(f_collectd); destination(d_collectd); };
log { source(s_src); filter(f_kern); destination(d_kern); };
log { source(s_src); filter(f_lpr); destination(d_lpr); };
#log { source(s_src); filter(f_syslog3); destination(d_syslog); };

View File

@ -40,6 +40,22 @@
endscript
}
/var/log/collectd.log
{
nodateext
size 10M
start 1
rotate 10
missingok
notifempty
compress
sharedscripts
postrotate
systemctl reload syslog-ng > /dev/null 2>&1 || true
endscript
}
/var/log/nfv-vim.log
{
nodateext