mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-11 03:32:53 +01:00
Merge pull request #1246 from Security-Onion-Solutions/fix/sensor_clean_log
Fix/sensor clean log
This commit is contained in:
2
salt/common/cron/sensor-rotate
Normal file
2
salt/common/cron/sensor-rotate
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
/usr/sbin/logrotate -f /opt/so/conf/sensor-rotate.conf > /dev/null 2>&1
|
||||||
10
salt/common/files/sensor-rotate.conf
Normal file
10
salt/common/files/sensor-rotate.conf
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/opt/so/log/sensor_clean.log
|
||||||
|
{
|
||||||
|
daily
|
||||||
|
rotate 2
|
||||||
|
missingok
|
||||||
|
nocompress
|
||||||
|
create
|
||||||
|
sharedscripts
|
||||||
|
endscript
|
||||||
|
}
|
||||||
@@ -163,4 +163,26 @@ utilsyncscripts:
|
|||||||
- daymonth: '*'
|
- daymonth: '*'
|
||||||
- month: '*'
|
- month: '*'
|
||||||
- dayweek: '*'
|
- dayweek: '*'
|
||||||
|
|
||||||
|
sensorrotatescript:
|
||||||
|
file.managed:
|
||||||
|
- name: /usr/local/bin/sensor-rotate
|
||||||
|
- source: salt://common/cron/sensor-rotate
|
||||||
|
- mode: 755
|
||||||
|
|
||||||
|
sensorrotateconf:
|
||||||
|
file.managed:
|
||||||
|
- name: /opt/so/conf/sensor-rotate.conf
|
||||||
|
- source: salt://common/files/sensor-rotate.conf
|
||||||
|
- mode: 644
|
||||||
|
|
||||||
|
/usr/local/bin/sensor-rotate:
|
||||||
|
cron.present:
|
||||||
|
- user: root
|
||||||
|
- minute: '*'
|
||||||
|
- hour: '*'
|
||||||
|
- daymonth: '*'
|
||||||
|
- month: '*'
|
||||||
|
- dayweek: '*'
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -115,7 +115,5 @@ if [ "$CUR_USAGE" -gt "$CRIT_DISK_USAGE" ]; then
|
|||||||
clean
|
clean
|
||||||
CUR_USAGE=$(df -P $SENSOR_DIR | tail -1 | awk '{print $5}' | tr -d %)
|
CUR_USAGE=$(df -P $SENSOR_DIR | tail -1 | awk '{print $5}' | tr -d %)
|
||||||
done
|
done
|
||||||
else
|
|
||||||
echo "$(date) - Current usage value of $CUR_USAGE not greater than CRIT_DISK_USAGE value of $CRIT_DISK_USAGE..." >> $LOG
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user