NGinx Logrotate

by | Mar 6, 2014 | IT Tips | 0 comments

When you start creating virtual hosts under NGinx and give them separate access and error logs don't forget to update the logrotate configuration otherwise your logs just keep growing.

I have named my logs with .access and .error extensions instead of the default .log option so that has necessitated the following change to the /etc/logrotate.d/nginx file

/var/log/nginx/*log /var/log/nginx/*access /var/log/nginx/*error {
    daily
    rotate 10
    missingok
    notifempty
    compress
    sharedscripts
    postrotate
        /bin/kill -USR1 $(cat /var/run/nginx.pid 2>/dev/null) 2>/dev/null || :
    endscript
}

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.