# logrotate.erb.conf # Logrotate config for <%= fetch(:application) %> <%= fetch(:stage) %> # Generated at <%= Time.now.strftime("%d.%m.%Y, %H:%M") %> <%= unicorn_log_dir %>/*.log { daily missingok rotate 180 compress dateext su <%= fetch(:unicorn_user) %> <%= fetch(:unicorn_user) %> # this is important if using "compress" since we need to call # the "lastaction" script below before compressing: delaycompress # note the lack of the evil "copytruncate" option in this # config. Unicorn supports the USR1 signal and we send it # as our "lastaction" action: # USR1 - reopen all logs owned by the master and all workers lastaction pid=<%= fetch(:unicorn_pid) %> test -s $pid && kill -USR1 "$(cat $pid)" endscript }