Skip to content

Instantly share code, notes, and snippets.

@namnv609
Created July 24, 2018 03:47
Show Gist options
  • Save namnv609/32e7d2f886ab873bba467f4062cba368 to your computer and use it in GitHub Desktop.
Save namnv609/32e7d2f886ab873bba467f4062cba368 to your computer and use it in GitHub Desktop.
Logrotate configuration for Puma and Sidekiq
/path/to/log/folder/*.log {
su deployer deployer
daily
rotate 7
missingok
dateext
compress
notifempty
olddir /path/to/old/folder
sharedscripts
postrotate
[ -e /path/to/puma/puma.pid ] && kill -HUP `cat /path/to/puma/puma.pid` && kill -USR1 `cat /path/to/puma/puma.pid` && [ -e /path/to/sidekiq/sidekiq-0.pid ] && kill -USR2 `cat /path/to/sidekiq/sidekiq-0.pid`
endscript
}
# Puma signals:
# -HUP: Reopen puma.*.log
# -USR1: Reopen <application>.log
# Sidekiq signal:
# -USR2: Reopen sidekiq log file(s)
# For multiple sidekiq indexes
# `cat /path/to/sidekiq/sidekiq-*.pid | xargs kill -USR2`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment