mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-10 11:12:51 +01:00
limit eve logs and gz files based on days
This commit is contained in:
@@ -24,15 +24,9 @@ read lastPID < $lf
|
|||||||
[ ! -z "$lastPID" -a -d /proc/$lastPID ] && exit
|
[ ! -z "$lastPID" -a -d /proc/$lastPID ] && exit
|
||||||
echo $$ > $lf
|
echo $$ > $lf
|
||||||
|
|
||||||
MAXEVES={{ salt['pillar.get']('suricata:cleanup:eve_json', 20) }}
|
MAXDAYS={{ salt['pillar.get']('suricata:cleanup:eve_json', 7) }}
|
||||||
if [ "$MAXEVES" -lt 2 ]; then
|
if [ "$MAXDAYS" -lt 1 ]; then
|
||||||
MAXEVES=2
|
MAXDAYS=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Find eve files and remove them
|
find /nsm/suricata/ -type f -mtime +$MAXDAYS -name 'eve-*.json*' -execdir rm -- '{}' \;
|
||||||
NUMEVES=$(find /nsm/suricata/ -type f -name "eve-*.json" | wc -l)
|
|
||||||
while [ "$NUMEVES" -gt "$MAXEVES" ]; do
|
|
||||||
OLDESTEVE=$(find /nsm/suricata/ -type f -name "eve-*.json" -type f -printf '%T+ %p\n' | sort | head -n 1 | awk -F" " '{print $2}')
|
|
||||||
rm -f $OLDESTEVE
|
|
||||||
NUMEVES=$(find /nsm/suricata/ -type f -name "eve-*.json" | wc -l)
|
|
||||||
done
|
|
||||||
Reference in New Issue
Block a user