mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Merge pull request #3012 from Security-Onion-Solutions/issue/2989
Issue/2989
This commit is contained in:
@@ -24,15 +24,9 @@ read lastPID < $lf
|
||||
[ ! -z "$lastPID" -a -d /proc/$lastPID ] && exit
|
||||
echo $$ > $lf
|
||||
|
||||
MAXEVES={{ salt['pillar.get']('suricata:cleanup:eve_json', 20) }}
|
||||
if [ "$MAXEVES" -lt 2 ]; then
|
||||
MAXEVES=2
|
||||
MAXDAYS={{ salt['pillar.get']('suricata:cleanup:eve_json', 7) }}
|
||||
if [ "$MAXDAYS" -lt 1 ]; then
|
||||
MAXDAYS=1
|
||||
fi
|
||||
|
||||
# Find eve files and remove them
|
||||
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
|
||||
find /nsm/suricata/ -type f -mtime +$MAXDAYS -name 'eve-*.json*' -execdir rm -- '{}' \;
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Gzip the eve logs
|
||||
find /nsm/suricata/eve*.json -type f -printf '%T@\t%p\n' | sort -t $'\t' -g | head -n -1 | cut -d $'\t' -f 2- | xargs nice gzip
|
||||
find /nsm/suricata/eve*.json -type f -printf '%T@\t%p\n' | sort -t $'\t' -g | head -n -1 | cut -d $'\t' -f 2 | xargs nice gzip
|
||||
|
||||
# TODO Add stats log
|
||||
Reference in New Issue
Block a user