logrotate: Rotate per-vhost logs by lighttpd.
authorMatthijs Kooijman <matthijs@stdin.nl>
Fri, 23 Jul 2010 11:41:02 +0000 (13:41 +0200)
committerMatthijs Kooijman <matthijs@stdin.nl>
Fri, 23 Jul 2010 11:41:02 +0000 (13:41 +0200)
Also call update-stats to update awstats after rotating.

etc/logrotate.d/data-www [new file with mode: 0644]

diff --git a/etc/logrotate.d/data-www b/etc/logrotate.d/data-www
new file mode 100644 (file)
index 0000000..931551b
--- /dev/null
@@ -0,0 +1,27 @@
+/data/www/*/logs/*/*.log {
+       # Rotate daily
+       daily
+       # Keep them all
+       rotate 9999
+       # Compress files after rotation
+       compress
+       # But only a day after actually rotating them for the first
+       # time. See http://bugs.gentoo.org/106651
+       delaycompress
+       notifempty
+       # Use the current date as the extension for rotating
+       dateext
+       # lighttpd will create new files itself
+       nocreate
+       # Call this script once after rotating all files
+       sharedscripts
+       postrotate
+               # Let lighttpd reopen its config files (HUP might be better,
+               # but we'd have to look in pidfiles etc.)
+               invoke-rc.d lighttpd reload > /dev/null;
+               # Do stats analysis on the rotated files
+               /usr/local/bin/update-stats --after-logrotate; #> /dev/null;
+       endscript
+}
+
+# vim: set ts=8 sw=8 noexpandtab autoindent: