Skip to content

Instantly share code, notes, and snippets.

@vidyasonawane
Created January 27, 2020 16:38
Show Gist options
  • Save vidyasonawane/0a13deb808ff4a939296cb9f133f349a to your computer and use it in GitHub Desktop.
Save vidyasonawane/0a13deb808ff4a939296cb9f133f349a to your computer and use it in GitHub Desktop.
/var/log/nginx/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
}
Notes for reference:
/var/log/nginx is the directory where the log files are stored.
*.log : all files having .log extension.
weekly : rotate on weekly basis
missingok : if any log file is missing, do not worry and continue
rotate 52 : 52 is the number of files you want to retain
compress : compress the files
delaycompress : don't compress the most recent log file
notifempty : don't rotate if logfile is empty
@vidyasonawane
Copy link
Author

copytruncate

we can also add copytruncate which copies the existing log files and then it truncates the current one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment