Make varnish log rotation less noisy
authorTollef Fog Heen <tfheen@err.no>
Sun, 28 Jun 2015 18:40:30 +0000 (20:40 +0200)
committerTollef Fog Heen <tfheen@err.no>
Sun, 28 Jun 2015 18:40:30 +0000 (20:40 +0200)
Import varnish.logrotate from current pkg-varnish git. This makes
varnishlog and varnishncsa log rotation be quiet.

modules/varnish/files/varnish.logrotate [new file with mode: 0644]
modules/varnish/manifests/init.pp

diff --git a/modules/varnish/files/varnish.logrotate b/modules/varnish/files/varnish.logrotate
new file mode 100644 (file)
index 0000000..afa230d
--- /dev/null
@@ -0,0 +1,29 @@
+/var/log/varnish/varnish.log {
+  daily
+  rotate 7
+  missingok
+  compress
+  delaycompress
+  missingok
+  postrotate
+    if [ -d /run/systemd/system ]; then
+       systemctl -q is-active varnishlog.service || exit 0
+    fi
+    /usr/sbin/invoke-rc.d varnishlog reload > /dev/null
+  endscript
+}
+
+/var/log/varnish/varnishncsa.log {
+  daily
+  rotate 7
+  missingok
+  compress
+  delaycompress
+  missingok
+  postrotate
+    if [ -d /run/systemd/system ]; then
+       systemctl -q is-active varnishncsa.service || exit 0
+    fi
+    /usr/sbin/invoke-rc.d varnishncsa reload > /dev/null
+  endscript
+}
index 004711e..4d10c66 100644 (file)
@@ -30,5 +30,11 @@ class varnish {
                notify =>  Service['varnish'],
                mode    => '0444',
         }
+
+        file { '/etc/logrotate.d/varnish':
+               source => 'puppet:///modules/varnish/varnish.logrotate',
+               require =>  Package['varnish'],
+               mode    => '0444',
+        }
 }