From af49353d9169d701c9df6f0839d61a1a7fe442dc Mon Sep 17 00:00:00 2001 From: Joao Paulo Tavares Musico Date: Wed, 1 Sep 2021 20:08:26 -0400 Subject: [PATCH] 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 Change-Id: Id1cdf58b5641abc105f41bbd910ca4ba1a1c55fe --- syslog-ng-config/files/syslog-ng.conf | 5 ++++- syslog-ng-config/files/syslog-ng.logrotate | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/syslog-ng-config/files/syslog-ng.conf b/syslog-ng-config/files/syslog-ng.conf index e40e6fd..c4e7e07 100644 --- a/syslog-ng-config/files/syslog-ng.conf +++ b/syslog-ng-config/files/syslog-ng.conf @@ -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); }; diff --git a/syslog-ng-config/files/syslog-ng.logrotate b/syslog-ng-config/files/syslog-ng.logrotate index 919184b..ab6bcf9 100644 --- a/syslog-ng-config/files/syslog-ng.logrotate +++ b/syslog-ng-config/files/syslog-ng.logrotate @@ -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