Parcourir la source

Set log watch to weekly per http://primozverdnik.com/2011/05/logwatch-once-a-week-is-enough/

Also mailing to root (which gets forwarded to admin_email) for easier automated sorting
Luke Cyca il y a 11 ans
Parent
révision
d71bf5632d

+ 12
- 3
roles/monitoring/tasks/logwatch.yml Voir le fichier

@@ -1,5 +1,14 @@
1 1
 - name: Install logwatch
2
-  apt: pkg=logwatch state=installed
2
+  apt: pkg={{ item }} state=installed
3
+  with_items:
4
+    - logwatch
5
+    - libdate-manip-perl
3 6
 
4
-- name: Configure logwatch to email {{ admin_email }} daily
5
-  action: lineinfile dest=/etc/cron.daily/00logwatch regexp="^/usr/sbin/logwatch" line="/usr/sbin/logwatch --output mail --mailto {{ admin_email }} --detail high" state=present create=yes
7
+- name: Configure logwatch
8
+  template: src=etc_logwatch_conf_logwatch.conf.j2 dest=/etc/logwatch/conf/logwatch.conf
9
+
10
+- name: Remove logwatch's dist cronjob
11
+  file: state=absent path=/etc/cron.daily/00logwatch
12
+
13
+- name: Configure weekly logwatch cronjob
14
+  cron: special_time=weekly job=/usr/sbin/logwatch name=logwatch

+ 3
- 0
roles/monitoring/templates/etc_logwatch_conf_logwatch.conf.j2 Voir le fichier

@@ -0,0 +1,3 @@
1
+Detail = High
2
+Output = mail
3
+Range = between -7 days and -1 days

Chargement…
Annuler
Enregistrer