Skip to content

Instantly share code, notes, and snippets.

@mattantonelli
Last active July 13, 2022 14:10
Show Gist options
  • Save mattantonelli/e8317dba141b7dc8179cfccfca23220c to your computer and use it in GitHub Desktop.
Save mattantonelli/e8317dba141b7dc8179cfccfca23220c to your computer and use it in GitHub Desktop.
logrotate configurations
# NGINX from source
/opt/nginx/logs/*.log {
su nginx nginx
weekly
dateext
dateformat .%Y-%m-%d
rotate 3
compress
delaycompress
create 0640 nginx nginx
sharedscripts
postrotate
[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
endscript
}
# Standard NGINX from yum
/var/log/nginx/*log {
create 0664 nginx root
daily
rotate 10
missingok
notifempty
compress
sharedscripts
postrotate
/bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
endscript
}
# Rails application
/var/rails/myapp/shared/log/*.log {
su nginx nginx
weekly
dateext
dateformat .%Y-%m-%d
rotate 3
compress
delaycompress
copytruncate
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment