summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Fenzi <kevin@scrye.com>2016-05-26 14:08:13 +0000
committerKevin Fenzi <kevin@scrye.com>2016-05-26 14:08:13 +0000
commitc0c992ede7a8b32df80c8e5d25d5eeeda9a7ebbe (patch)
treedda604e5c9d54653a6352eed28fc7f7193f38230
parente99af901928385caea4068711a849e9c49e9cd47 (diff)
downloadansible-c0c992ede7a8b32df80c8e5d25d5eeeda9a7ebbe.tar.gz
ansible-c0c992ede7a8b32df80c8e5d25d5eeeda9a7ebbe.tar.xz
ansible-c0c992ede7a8b32df80c8e5d25d5eeeda9a7ebbe.zip
Compress maillogs on bastion hosts/mail hubs with xz and keep 14 days of them.
-rw-r--r--roles/packager_alias/files/syslog24
-rw-r--r--roles/packager_alias/tasks/main.yml8
2 files changed, 32 insertions, 0 deletions
diff --git a/roles/packager_alias/files/syslog b/roles/packager_alias/files/syslog
new file mode 100644
index 000000000..383d9cf33
--- /dev/null
+++ b/roles/packager_alias/files/syslog
@@ -0,0 +1,24 @@
+/var/log/cron
+/var/log/messages
+/var/log/secure
+/var/log/spooler
+{
+ missingok
+ sharedscripts
+ postrotate
+ /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
+ endscript
+}
+/var/log/maillog {
+ daily
+ rotate 14
+ missingok
+ ifempty
+ compress
+ compresscmd /usr/bin/xz
+ uncompresscmd /usr/bin/xz
+ compressext .xz
+ dateext
+ sharedscripts
+ copytruncate
+}
diff --git a/roles/packager_alias/tasks/main.yml b/roles/packager_alias/tasks/main.yml
index aefe04bf2..759d8b777 100644
--- a/roles/packager_alias/tasks/main.yml
+++ b/roles/packager_alias/tasks/main.yml
@@ -11,3 +11,11 @@
tags:
- install
+#
+# Since this host has mail aliases, it's a mail hub. Compress logs since there will be a ton of them
+#
+
+- name: install modified logrotate syslog script to compress maillog on mailhub
+ copy: src=syslog dest=/etc/logrotate.d/syslog owner=root group=root
+ tags:
+ - install