Skip to content

Instantly share code, notes, and snippets.

@pramoso
Created June 29, 2023 20:46
Show Gist options
  • Save pramoso/5fc7f97c87cc0238d88ce13cb775e348 to your computer and use it in GitHub Desktop.
Save pramoso/5fc7f97c87cc0238d88ce13cb775e348 to your computer and use it in GitHub Desktop.
Logrotate config
/var/www/single-site.com/logs/*.log {
# daily: perform the rotation every day
daily
# rotate 14: remove the log files after 14 days
rotate 14
# size 1M: only rotate logs that are a minimum of 1MB
size 1M
# compress: all rotated logs will also be compressed
compress
# compress: all rotated logs will also be compressed
missingok
# notifempty: prevent empty logs from being rotated
notifempty
# dateext: use the date as a suffix of the rotated files
dateext
# create: create a new log file with a specific name and permissions after rotating the old one
create 0664 www-data www-data
sharedscripts
postrotate
invoke-rc.d nginx rotate >/dev/null 2>&1
endscript
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment