Linux rotating log files with logrotate
Created: | Updated:Add it to the crontab
Once at for in the morning should be ok for a small server
0 4 * * * logrotate /etc/logrotate.conf
Logrotate Configuration Files
The main configuration on CentOS7 is found in /etc/logrotate.conf and your custom configs should be done in /etc/logrotate.d/
Example Entry for nginx:
/var/log/nginx/*.log {
        daily
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 640 nginx adm
        sharedscripts
        postrotate
                if [ -f /var/run/nginx.pid ]; then
                        kill -USR1 `cat /var/run/nginx.pid`
                fi
        endscript
}
