From b443240bd6f333b714220857c52877309b2c3ae0 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 11 May 2016 22:23:16 +0100 Subject: [PATCH] Reduce number of nginx logs kept on tile caches --- cookbooks/tilecache/recipes/default.rb | 7 +++++++ .../templates/default/logrotate.nginx.erb | 15 +++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 cookbooks/tilecache/templates/default/logrotate.nginx.erb 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 +} -- 2.43.2