Last active
June 26, 2017 00:05
-
-
Save kvn1234/7b28727e3b482e1c7fe83d0879ab8e5d to your computer and use it in GitHub Desktop.
Create logrotater - linux
This file contains 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
**** create file: sudo vi /etc/logrotate.d/descriptive_name_here | |
**** code example, e.g., this one is symfony: | |
/var/www/current/var/logs/prod.log { | |
su ubuntu www-data | |
create 0664 ubuntu www-data | |
daily | |
missingok | |
rotate 14 | |
compress | |
} | |
**** IMPORTANT: first line is path to application's log, so change to match | |
**** change "su ubuntu www-data" to user/group application runs under, i.e., www-data www-data for nginx | |
**** test config with sudo logrotate --d /etc/logrotate.d/file_name_from_above | |
**** option force rotation: sudo logrotate --force /etc/logrotate.d/file_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment