Last active
September 20, 2023 14:57
-
-
Save iamdbc/f73b1984a8ffe239b5e197ad8f5e9e87 to your computer and use it in GitHub Desktop.
logrotate for puma on rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# file location: /etc/logrotate.d | |
/home/deploy/app/your-app/shared/log/*.log { | |
daily | |
missingok | |
rotate 14 | |
compress | |
delaycompress | |
dateext | |
notifempty | |
copytruncate | |
create 0640 deploy deploy # set file owner & group | |
sharedscripts | |
postrotate | |
kill -HUP `cat /home/deploy/app/your-app/shared/tmp/pids/puma.pid` # puma.pid | |
invoke-rc.d nginx rotate >/dev/null 2>&1 # You could put nginx log of your app into rails log folder, ignore this line if your nginx log not in your rails log foler. | |
endscript | |
} | |
# kill -HUP reopen puma.*.log, more details in https://github.com/puma/puma/blob/master/docs/signals.md |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment