]> git.openstreetmap.org Git - chef.git/commitdiff
Manage rotation of planet logs with archiving
authorTom Hughes <tom@compton.nu>
Fri, 5 Jul 2013 08:24:52 +0000 (09:24 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 5 Jul 2013 08:24:52 +0000 (09:24 +0100)
cookbooks/planet/recipes/default.rb
cookbooks/planet/templates/default/logrotate.apache.erb [new file with mode: 0644]

index c9e99852405afb2a346a790e624712e230d06efc..11e90edfbbf1fe579a3cd5cf112b862b55715860 100644 (file)
@@ -70,3 +70,10 @@ apache_module "proxy_http"
 apache_site "planet.openstreetmap.org" do
   template "apache.erb"
 end
+
+template "/etc/logrotate.d/apache2" do
+  source "logrotate.apache.erb"
+  owner "root"
+  group "root"
+  mode 0644
+end
diff --git a/cookbooks/planet/templates/default/logrotate.apache.erb b/cookbooks/planet/templates/default/logrotate.apache.erb
new file mode 100644 (file)
index 0000000..e7d9e3c
--- /dev/null
@@ -0,0 +1,21 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+/var/log/apache2/*.log {
+       weekly
+       missingok
+       rotate 52
+       compress
+       delaycompress
+       notifempty
+       create 640 root adm
+       sharedscripts
+       postrotate
+               /etc/init.d/apache2 reload > /dev/null
+               rsync /var/log/apache2/planet.openstreetmap.org-access.log.2.gz horntail::logs/planet.openstreetmap.org/`date -d "-7 days" +%Y-%m-%d`.gz
+       endscript
+       prerotate
+               if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
+                       run-parts /etc/logrotate.d/httpd-prerotate; \
+               fi; \
+       endscript
+}