mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Rotate suri stats log hourly
This commit is contained in:
6
salt/suricata/cron/surirotate
Normal file
6
salt/suricata/cron/surirotate
Normal file
@@ -0,0 +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
|
||||||
|
|
||||||
|
# TODO Add stats log
|
||||||
@@ -79,6 +79,12 @@ surilogscript:
|
|||||||
- source: salt://suricata/cron/surilogcompress
|
- source: salt://suricata/cron/surilogcompress
|
||||||
- mode: 755
|
- mode: 755
|
||||||
|
|
||||||
|
surirotatescript:
|
||||||
|
file.managed:
|
||||||
|
- name: /usr/local/bin/surirotate
|
||||||
|
- source: salt://suricata/cron/surirotate
|
||||||
|
- mode: 755
|
||||||
|
|
||||||
/usr/local/bin/surilogcompress:
|
/usr/local/bin/surilogcompress:
|
||||||
cron.present:
|
cron.present:
|
||||||
- user: suricata
|
- user: suricata
|
||||||
@@ -155,6 +161,15 @@ so-suricata:
|
|||||||
|
|
||||||
surilogrotate:
|
surilogrotate:
|
||||||
file.managed:
|
file.managed:
|
||||||
- name: /etc/logrotate.d/suristats
|
- name: /opt/so/conf/suricata/suri-rotate.conf
|
||||||
- source: salt://suricata/files/suri-rotate.conf
|
- source: salt://suricata/files/suri-rotate.conf
|
||||||
- mode: 644
|
- mode: 644
|
||||||
|
|
||||||
|
/usr/local/bin/surirotate:
|
||||||
|
cron.present:
|
||||||
|
- user: root
|
||||||
|
- minute: '6'
|
||||||
|
- hour: '*'
|
||||||
|
- daymonth: '*'
|
||||||
|
- month: '*'
|
||||||
|
- dayweek: '*'
|
||||||
|
|||||||
Reference in New Issue
Block a user