From 3c1e9d960198c044e382eb7d47b3bb70cbf6ba70 Mon Sep 17 00:00:00 2001 From: Eric MacDonald Date: Tue, 6 Apr 2021 10:29:09 -0400 Subject: [PATCH] Modify mtce daemon log rotation config files This update make the following setting changes to the maintenance log rotation configuration files - add 'create' with permissions to each tuple - add 'delaycompress' - group together log files with similar settings - move global settings ro local settings - remove 'copytruncate' global setting - remove the 'nodateext' global and local setting Test Plan: PASS: Verify log rotation for all mtc log files PASS: Verify no log loss over rotation PASS: Verify log rotation file naming convention PASS: Verify delaycompress on all mtce log files PASS: Verify log permissions after rotate are 0640 Regression: PASS: Verify AIO system install PASS: Verify Standard system install PASS: Verify full and dated collect Change-Id: I623030fa2c1ce4e8085e654ae3fb782c7e520924 Partial-Bug: 1918979 Depends-On: https://review.opendev.org/c/starlingx/config-files/+/784943 Signed-off-by: Eric MacDonald --- mtce/src/alarm/scripts/mtcalarm.logrotate | 18 ++--- mtce/src/fsmon/scripts/fsmon.logrotate | 14 ++-- mtce/src/hostw/scripts/hostw.logrotate | 15 +++-- mtce/src/hwmon/scripts/hwmon.logrotate | 33 ++++----- mtce/src/lmon/scripts/lmon.logrotate | 15 +++-- mtce/src/pmon/scripts/pmon.logrotate | 15 +++-- mtce/src/pmon/scripts/pmond.conf | 0 mtce/src/scripts/crashdump.logrotate | 6 +- mtce/src/scripts/mtce.logrotate | 82 +++++++++++++---------- 9 files changed, 109 insertions(+), 89 deletions(-) mode change 100755 => 100644 mtce/src/pmon/scripts/pmon.logrotate mode change 100755 => 100644 mtce/src/pmon/scripts/pmond.conf diff --git a/mtce/src/alarm/scripts/mtcalarm.logrotate b/mtce/src/alarm/scripts/mtcalarm.logrotate index c1b91aa2..8287c7e5 100644 --- a/mtce/src/alarm/scripts/mtcalarm.logrotate +++ b/mtce/src/alarm/scripts/mtcalarm.logrotate @@ -1,17 +1,19 @@ -#daily -nodateext -start 1 -compress -copytruncate -notifempty -missingok +# +# Copyright (c) 2018-2021 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 /var/log/mtcalarmd.log { + create 0640 root root + start 1 size 10M rotate 20 - sharedscripts + compress + notifempty + missingok postrotate systemctl reload syslog-ng > /dev/null 2>&1 || true endscript + delaycompress } diff --git a/mtce/src/fsmon/scripts/fsmon.logrotate b/mtce/src/fsmon/scripts/fsmon.logrotate index 0476a8b2..821391f8 100644 --- a/mtce/src/fsmon/scripts/fsmon.logrotate +++ b/mtce/src/fsmon/scripts/fsmon.logrotate @@ -1,15 +1,19 @@ -#daily -nodateext +# +# Copyright (c) 2015-2021 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 /var/log/fsmond.log { - size 10M + create 0640 root root start 1 - missingok + size 10M rotate 20 compress - sharedscripts + notifempty + missingok postrotate systemctl reload syslog-ng > /dev/null 2>&1 || true endscript + delaycompress } diff --git a/mtce/src/hostw/scripts/hostw.logrotate b/mtce/src/hostw/scripts/hostw.logrotate index 065ccc1f..cb2f6aa4 100644 --- a/mtce/src/hostw/scripts/hostw.logrotate +++ b/mtce/src/hostw/scripts/hostw.logrotate @@ -1,16 +1,19 @@ -#daily -nodateext +# +# Copyright (c) 2020-2021 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 /var/log/hostwd.log { - nodateext - size 10M + create 0640 root root start 1 - missingok + size 10M rotate 20 compress - sharedscripts + notifempty + missingok postrotate systemctl reload syslog-ng > /dev/null 2>&1 || true endscript + delaycompress } diff --git a/mtce/src/hwmon/scripts/hwmon.logrotate b/mtce/src/hwmon/scripts/hwmon.logrotate index dd1eceee..e8ce8e66 100644 --- a/mtce/src/hwmon/scripts/hwmon.logrotate +++ b/mtce/src/hwmon/scripts/hwmon.logrotate @@ -1,28 +1,21 @@ -#daily -nodateext -start 1 -missingok -notifempty -compress -sharedscripts -postrotate - systemctl reload syslog-ng > /dev/null 2>&1 || true -endscript +# +# Copyright (c) 2020-2021 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 /var/log/hwmond.log -{ - size 50M - rotate 5 -} - /var/log/hwmond_event.log -{ - size 50M - rotate 5 -} - /var/log/hwmond_api.log { + create 0640 root root + start 1 size 50M rotate 5 + compress + notifempty + missingok + postrotate + systemctl reload syslog-ng > /dev/null 2>&1 || true + endscript + delaycompress } diff --git a/mtce/src/lmon/scripts/lmon.logrotate b/mtce/src/lmon/scripts/lmon.logrotate index b59fa9ff..e6fe3191 100644 --- a/mtce/src/lmon/scripts/lmon.logrotate +++ b/mtce/src/lmon/scripts/lmon.logrotate @@ -1,16 +1,19 @@ -#daily -nodateext +# +# Copyright (c) 2020-2021 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 /var/log/lmond.log { - nodateext - size 10M + create 0640 root root start 1 - missingok + size 10M rotate 20 compress - sharedscripts + notifempty + missingok postrotate systemctl reload syslog-ng > /dev/null 2>&1 || true endscript + delaycompress } diff --git a/mtce/src/pmon/scripts/pmon.logrotate b/mtce/src/pmon/scripts/pmon.logrotate old mode 100755 new mode 100644 index ea151b26..08416fb9 --- a/mtce/src/pmon/scripts/pmon.logrotate +++ b/mtce/src/pmon/scripts/pmon.logrotate @@ -1,16 +1,19 @@ -#daily -nodateext +# +# Copyright (c) 2015-2021 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 /var/log/pmond.log { - nodateext - size 10M + create 0640 root root start 1 - missingok + size 10M rotate 20 compress - sharedscripts + notifempty + missingok postrotate systemctl reload syslog-ng > /dev/null 2>&1 || true endscript + delaycompress } diff --git a/mtce/src/pmon/scripts/pmond.conf b/mtce/src/pmon/scripts/pmond.conf old mode 100755 new mode 100644 diff --git a/mtce/src/scripts/crashdump.logrotate b/mtce/src/scripts/crashdump.logrotate index a16bcb7c..ca8e84c6 100644 --- a/mtce/src/scripts/crashdump.logrotate +++ b/mtce/src/scripts/crashdump.logrotate @@ -1,7 +1,11 @@ +# +# Copyright (c) 2020-2021 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 + /var/log/crash/vmcore.tar /var/log/crash/vmcore_first.tar { - nodateext size 1K start 1 rotate 1 diff --git a/mtce/src/scripts/mtce.logrotate b/mtce/src/scripts/mtce.logrotate index 17842c8a..8095f311 100644 --- a/mtce/src/scripts/mtce.logrotate +++ b/mtce/src/scripts/mtce.logrotate @@ -1,59 +1,67 @@ -#daily - -# Apply all these options to all the logs -nodateext -start 1 -compress -notifempty -missingok -sharedscripts -postrotate - systemctl reload syslog-ng > /dev/null 2>&1 || true -endscript - +# +# Copyright (c) 2015-2021 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# /var/log/mtcAgent.log { - size 100M + create 0640 root root + start 1 rotate 10 + size 100M + compress + notifempty + missingok + postrotate + systemctl reload syslog-ng > /dev/null 2>&1 || true + endscript + delaycompress } /var/log/hbsAgent.log -{ - size 20M - rotate 5 -} - /var/log/mtcClient.log -{ - size 20M - rotate 5 -} - /var/log/hbsClient.log { - size 20M + create 0640 root root + start 1 rotate 5 + size 20M + compress + notifempty + missingok + postrotate + systemctl reload syslog-ng > /dev/null 2>&1 || true + endscript + delaycompress } /var/log/mtclogd.log { - size 10M + create 0640 root root + start 1 rotate 5 + size 10M + compress + notifempty + missingok + postrotate + systemctl reload syslog-ng > /dev/null 2>&1 || true + endscript + delaycompress } +# The mtclogd opens and closes these log files on every log addition. +# Therefore does not require a notification over log rotation. +/var/log/mtcAgent_event.log +/var/log/mtcAgent_alarm.log /var/log/mtcAgent_api.log { - size 20M + create 0640 root root + start 1 rotate 5 -} - -/var/log/mtcAgent_event.log -{ - size 20M - rotate 5 -} -/var/log/mtcAgent_alarm.log -{ size 10M - rotate 5 + compress + notifempty + missingok + delaycompress }