FIX: broken nginx log file rotation
authorSam <sam.saffron@gmail.com>
Thu, 16 Apr 2015 01:30:37 +0000 (11:30 +1000)
committerSam <sam.saffron@gmail.com>
Thu, 16 Apr 2015 01:31:09 +0000 (11:31 +1000)
templates/web.template.yml

index c094b7acf98ec849d7ea9a5b95048e9955e61aca..c40452e11d8b54e45405b0f3fdf0c8fa9da0078f 100644 (file)
@@ -189,15 +189,22 @@ run:
                 endscript
         }
 
-  - replace:
-      filename: "/etc/logrotate.d/nginx"
-      from: "weekly"
-      to: "daily"
-
-  - replace:
-      filename: "/etc/logrotate.d/nginx"
-      from: "52"
-      to: "14"
+  - file:
+     path: /etc/logrotate.d/nginx
+     contents: |
+        /var/log/nginx/*.log {
+          daily
+          missingok
+          rotate 14
+          compress
+          delaycompress
+          notifempty
+          create 0640 www-data adm
+          sharedscripts
+          postrotate
+            sv 1 nginx
+          endscript
+        }
 
   # move state out of the container this fancy is done to support rapid rebuilds of containers,
   # we store anacron and logrotate state outside the container to ensure its maintained across builds