]> git.openstreetmap.org Git - chef.git/commitdiff
tilecache: rsync logs to ironbelly on logrotate
authorGrant Slater <git@firefishy.com>
Tue, 1 Oct 2013 14:10:52 +0000 (15:10 +0100)
committerGrant Slater <git@firefishy.com>
Tue, 1 Oct 2013 14:10:52 +0000 (15:10 +0100)
cookbooks/tilecache/recipes/default.rb
cookbooks/tilecache/templates/default/logrotate.squid.erb [new file with mode: 0644]

index 7feb45fc98b65522ee71fbd95c8e87b8b13314d8..4015f994104305fa6369d28280691481da9f3ab4 100644 (file)
@@ -48,3 +48,11 @@ squid_fragment "tilecache" do
   template "squid.conf.erb"
   variables :caches => tilecaches
 end
   template "squid.conf.erb"
   variables :caches => tilecaches
 end
+
+template "/etc/logrotate.d/squid" do
+  source "logrotate.squid.erb"
+  owner "root"
+  group "root"
+  mode 0644
+end
+
diff --git a/cookbooks/tilecache/templates/default/logrotate.squid.erb b/cookbooks/tilecache/templates/default/logrotate.squid.erb
new file mode 100644 (file)
index 0000000..80953e8
--- /dev/null
@@ -0,0 +1,15 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+/var/log/squid/*.log {
+  daily
+  compress
+  delaycompress
+  rotate 2
+  missingok
+  nocreate
+  sharedscripts
+  postrotate
+    test ! -e /var/run/squid.pid || /usr/sbin/squid -k rotate
+    /usr/bin/rsync /var/log/squid/zere.log.2.gz ironbelly::logs/tile.openstreetmap.org/<%= node[:hostname] %>-`date -d "-2 days" +%Y-%m-%d`.gz
+  endscript
+}