From 5c25dcf1923a1b8bbe44a0c106d12989bdc5533f Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Mon, 16 Nov 2020 09:50:10 -0500 Subject: [PATCH] add /opt/so/log/salt/so-salt-minion-check to log rotate https://github.com/Security-Onion-Solutions/securityonion/issues/1831 --- salt/common/files/log-rotate.conf | 1 + salt/common/tools/sbin/so-salt-minion-check | 4 ++-- salt/salt/minion.defaults.yaml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/salt/common/files/log-rotate.conf b/salt/common/files/log-rotate.conf index d383981cd..8f1df0307 100644 --- a/salt/common/files/log-rotate.conf +++ b/salt/common/files/log-rotate.conf @@ -18,6 +18,7 @@ /opt/so/log/filebeat/*.log /opt/so/log/telegraf/*.log /opt/so/log/redis/*.log +/opt/so/log/salt/so-salt-minion-check { {{ logrotate_conf | indent(width=4) }} } diff --git a/salt/common/tools/sbin/so-salt-minion-check b/salt/common/tools/sbin/so-salt-minion-check index 25302802c..a8828b16e 100644 --- a/salt/common/tools/sbin/so-salt-minion-check +++ b/salt/common/tools/sbin/so-salt-minion-check @@ -32,7 +32,7 @@ CURRENT_TIME=$(date +%s) SYSTEM_START_TIME=$(date -d "$(> "/opt/so/log/salt/so-salt-minion-check" 2>&1 + echo -e "$now | $level | $msg" >> "/opt/so/log/salt/so-salt-minion-check" 2>&1 } error() { diff --git a/salt/salt/minion.defaults.yaml b/salt/salt/minion.defaults.yaml index 1513803d8..871babdeb 100644 --- a/salt/salt/minion.defaults.yaml +++ b/salt/salt/minion.defaults.yaml @@ -3,4 +3,4 @@ salt: minion: version: 3002.1 - check_threshold: 3600 # in seconds, threshold used for so-salt-minion-check. setting less that 600 cause cause a lot of salt-minion restarts \ No newline at end of file + check_threshold: 3600 # in seconds, threshold used for so-salt-minion-check. any value less than 600 seconds may cause a lot of salt-minion restarts since the job to touch the file occurs every 5-8 minutes by default \ No newline at end of file