Add log rotation for chef server nginx logs
authorTom Hughes <tom@compton.nu>
Wed, 8 Apr 2015 17:54:08 +0000 (18:54 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 8 Apr 2015 17:58:14 +0000 (18:58 +0100)
cookbooks/chef/recipes/server.rb
cookbooks/chef/templates/default/logrotate.server.erb [new file with mode: 0644]

index 37c84e7..e76e074 100644 (file)
@@ -102,3 +102,10 @@ template "/etc/cron.daily/chef-server-backup" do
   group "root"
   mode 0755
 end
+
+template "/etc/logrotate.d/chef-server" do
+  source "logrotate.server.erb"
+  owner "root"
+  group "root"
+  mode 0644
+end
diff --git a/cookbooks/chef/templates/default/logrotate.server.erb b/cookbooks/chef/templates/default/logrotate.server.erb
new file mode 100644 (file)
index 0000000..d075725
--- /dev/null
@@ -0,0 +1,12 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+/var/log/chef-server/nginx/access.log
+/var/log/chef-server/nginx/error.log
+/var/log/chef-server/nginx/rewrite-port-80.log {
+  rotate 12
+  weekly
+  compress
+  postrotate
+        chef-server-ctl hup
+  endscript
+}