Skip to content

Commit

Permalink
Adding log rotation for bistream logs
Browse files Browse the repository at this point in the history
  • Loading branch information
amerck committed Jan 11, 2019
1 parent 4e51ca6 commit 835a21e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions clean_bistreams.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# Compress bistream files older than 1 hour
find /opt/dionaea/var/dionaea/bistreams/* -type f -mmin +5 -exec gzip {} \;

# Clear bistream logs from dionaea every day
find /opt/dionaea/var/dionaea/bistreams/* -type f -mtime +60 -exec rm {} \;
find /opt/dionaea/var/dionaea/bistreams/* -type d -empty -delete
3 changes: 3 additions & 0 deletions cron.run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
exec 2>&1
exec cron -f -l
23 changes: 23 additions & 0 deletions dionaea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,29 @@
group: nogroup
recurse: yes

- name: Dionaea | set clean_bistreams.sh file permissions
file:
path: "/opt/clean_bistreams.sh"
mode: 0755

- name: Dionaea | set clean_bistreams.sh cron
cron:
name: "clean bistreams"
job: "/opt/clean_bistreams.sh"
minute: "*/5"

- name: Dionaea | create cron runit directories
file:
state: directory
path: "/etc/service/cron"
mode: 0755

- name: Dionaea | create dionaea runit run file
template:
src: cron.run
dest: "/etc/service/cron/run"
mode: 0755

- name: Dionaea | copy dionaea sysconfig file
copy:
dest: "{{ sysconfig_dir }}/dionaea"
Expand Down
1 change: 1 addition & 0 deletions vars/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- check
- libtool
- curl
- cron

dionaea_repo: http://github.com/dinotools/dionaea

Expand Down

0 comments on commit 835a21e

Please sign in to comment.