From 036cdd6e57d46c4c4afe29a986cd90f45da92bb2 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sun, 20 Sep 2020 22:24:49 -0500 Subject: [PATCH] syslog clean up --- roles/rsyslog/tasks/archival.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/roles/rsyslog/tasks/archival.yaml b/roles/rsyslog/tasks/archival.yaml index 08b1c57..102b52c 100644 --- a/roles/rsyslog/tasks/archival.yaml +++ b/roles/rsyslog/tasks/archival.yaml @@ -68,5 +68,14 @@ minute: "0" hour: "1" user: root - job: find /var/log/syslog/ -type f -name "*.log" -mtime +5 -exec xz {} \; + job: find /var/log/syslog/ -mindepth 4 -type f -name "*.log" -mtime +5 -exec xz {} \; + state: "{{ rsyslog_archival_format_enabled | ternary('present', 'absent') }}" + +- name: purge log cron job + cron: + name: purge syslog + minute: "0" + hour: "2" + user: root + job: find /var/log/syslog/ -mindepth 4 -type f -name "*.log" -mtime +90 -delete state: "{{ rsyslog_archival_format_enabled | ternary('present', 'absent') }}"