Skip to content

How to manage your log file by using logrotate utility

Taymindis Woon edited this page Jan 22, 2018 · 2 revisions

sudo vim /etc/logrotate.d/ffunc

/etc/nginx/logs/error.log {
    rotate 7
    size 5k
    dateext
    dateformat -%Y-%m-%d
    missingok
    compress
    sharedscripts
    postrotate
        test -r /var/run/nginx.pid && kill -USR1 `cat /var/run/nginx.pid`
    endscript
}

sudo logrotate /etc/logrotate.d/ffun

Reference