Skip to content

Instantly share code, notes, and snippets.

@krisleech
Created December 5, 2017 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisleech/f97ce3aae3ebebce810bc811e57bb159 to your computer and use it in GitHub Desktop.
Save krisleech/f97ce3aae3ebebce810bc811e57bb159 to your computer and use it in GitHub Desktop.
```
{{ deploy_to }}/shared/log/*.log {
missingok
compress
delaycompress
weekly
rotate 128
copytruncate
create 660 {{ deploy_user }} {{ deploy_user }}
}
```
`compress` with `delaycompress` will keep last log file uncompressed until next rotation, so you will have production.log (current log) and production.log.1 (last log) and production.log.2.gzip.
`copytruncate` truncate existing log instead of copying, meaning any apps which are using log can continue to do so without opening a new log file.
`weekly` and `rotate 128` will keep ~2 years worth of logs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment