]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/tilecache/templates/default/logrotate.squid.erb
Fix logrotate for squid 4.11
[chef.git] / cookbooks / tilecache / templates / default / logrotate.squid.erb
index 80953e840c409ccf8ab723e05e8d59602b62af39..40a2240b419c66c6bb5984a24373fb7ed689bb88 100644 (file)
@@ -3,13 +3,22 @@
 /var/log/squid/*.log {
   daily
   compress
-  delaycompress
+  compresscmd /usr/bin/xz
+  compressoptions --threads=<%= [ node[:cpu][:total] / 2, 1 ].max.ceil %>
+  uncompresscmd /usr/bin/unxz
+  compressext .xz
   rotate 2
   missingok
   nocreate
   sharedscripts
   postrotate
+<% if node[:lsb][:release].to_f < 20.04 -%>
     test ! -e /var/run/squid.pid || /usr/sbin/squid -k rotate
-    /usr/bin/rsync /var/log/squid/zere.log.2.gz ironbelly::logs/tile.openstreetmap.org/<%= node[:hostname] %>-`date -d "-2 days" +%Y-%m-%d`.gz
+<% else -%>
+    test ! -e /run/squid/squid.pid || /usr/sbin/squid -k rotate
+<% end -%>
+  endscript
+  lastaction
+    /usr/bin/rsync --preallocate /var/log/squid/access.log.1.xz ironbelly::logs/tile.openstreetmap.org/<%= node[:hostname] %>-`date -d "-1 days" +%Y-%m-%d`.xz || true
   endscript
 }