Rotating access.log and error.log

emil | uruz.org nginx at uruz.org
Sun Dec 13 02:30:31 MSK 2009


Danny Trinh wrote:
>
> Hello group,
>
> I like nginx. I have a dumb question: Is there a way that I can setup 
> to rotate the nginx logfiles? My access.log is growing over 700MB.
>
> Thanks,
>
>  
>
> _Danny Trinh_
>
> Linux Admin
>
> cid:image001.png at 01C9C726.FEA6D1C0
>
>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>   
You can do it with logrotate like in this example /etc/logrotate.d/nginx

/var/logs/nginx/*.log {
missingok
notifempty
sharedscripts
postrotate
test ! -f /var/run/nginx.pid || kill -USR1 `cat /var/run/nginx.pid`
endscript

}

And you might want to have a look at http://wiki.nginx.org/NginxLogRotation

Best,
Emil

-- 
http://uruz.org



More information about the nginx mailing list