From: Tom Hughes Date: Wed, 11 May 2016 21:23:16 +0000 (+0100) Subject: Reduce number of nginx logs kept on tile caches X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/b443240bd6f333b714220857c52877309b2c3ae0?ds=sidebyside Reduce number of nginx logs kept on tile caches --- diff --git a/cookbooks/tilecache/recipes/default.rb b/cookbooks/tilecache/recipes/default.rb index 1f02661b7..86c7d0250 100644 --- a/cookbooks/tilecache/recipes/default.rb +++ b/cookbooks/tilecache/recipes/default.rb @@ -101,6 +101,13 @@ service "nginx-certificate-restart" do subscribes :restart, "file[/etc/ssl/private/#{certificate}.key]" end +template "/etc/logrotate.d/nginx" do + source "logrotate.nginx.erb" + owner "root" + group "root" + mode 0644 +end + tilerenders.each do |render| munin_plugin "ping_#{render[:fqdn]}" do target "ping_" diff --git a/cookbooks/tilecache/templates/default/logrotate.nginx.erb b/cookbooks/tilecache/templates/default/logrotate.nginx.erb new file mode 100644 index 000000000..b52d294fd --- /dev/null +++ b/cookbooks/tilecache/templates/default/logrotate.nginx.erb @@ -0,0 +1,15 @@ +# DO NOT EDIT - This file is being maintained by Chef + +/var/log/nginx/*.log { + daily + missingok + rotate 7 + compress + delaycompress + notifempty + create 640 nginx adm + sharedscripts + postrotate + [ -f /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid` + endscript +}