]> git.openstreetmap.org Git - chef.git/blob - cookbooks/web/templates/default/logrotate.web.erb
Fix log rotation on web servers
[chef.git] / cookbooks / web / templates / default / logrotate.web.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 <%= node[:web][:log_directory] %>/*.log {
4   daily
5   missingok
6   rotate 7
7   compress
8   delaycompress
9   notifempty
10   su rails rails
11   create 0660 rails rails
12   sharedscripts
13   postrotate
14 <% if node[:recipes].include?("web::rails") -%>
15     /bin/sleep 30
16     PASSENGER_INSTANCE_REGISTRY_DIR=<%= node[:passenger][:instance_registry_dir] %> /usr/bin/passenger-config restart-app --ignore-app-not-running --name rails > /dev/null
17 <% end -%>
18 <% if node[:recipes].include?("web::frontend") -%>
19     /bin/systemctl try-reload-or-restart rails-jobs@mailers
20     /bin/systemctl try-reload-or-restart rails-jobs@storage
21     /bin/systemctl try-reload-or-restart rails-jobs@traces
22 <% end -%>
23 <% if node[:recipes].include?("web::cgimap") -%>
24     /bin/systemctl reload cgimap
25     /usr/bin/rsync --preallocate <%= node[:web][:log_directory] %>/cgimap.log.2.gz ironbelly::logs/www.openstreetmap.org/cgimap-<%= node[:hostname] %>-`date -d "-2 days" +%Y-%m-%d`.gz
26 <% end -%>
27   endscript
28 }