Rotating access.log and error.log


nginx mailing list
[email protected]
http://nginx.org/mailman/listinfo/nginx

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.

Use logrotate(8) or use a shell script. Remember that you need to run

$ kill -USR1 /path/to/nginx

in order to re-open the log file.



nginx mailing list
[email protected]
nginx Info Page


Jim O.

Danny Trinh wrote:

Danny Trinh
nginx mailing list
[email protected]
nginx Info Page

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