Public bug reported:

in nginx-common package there's the script to rotate nginx logs  but it does 
not work as intended:
it does rename the log but nginx keeps writing on that one.

this is because -USR1 signal doesn't seem to work, you have to use -HUP
and then nginx will close and reopen logs files (without resetting
uptime which is nice for detecting if webserver is stable or not) .

so i had to change my /etc/logrotate.d/nginx script from:

postrotate
        [ -s /run/nginx.pid ] && kill -USR1 `cat /run/nginx.pid`
endscript

to

postrotate
    /etc/init.d/nginx reload
endscript

to make it properly rotate log files.

** Affects: nginx
     Importance: Undecided
         Status: New


** Tags: trusty

** Tags added: trusty

** Also affects: ubuntu
   Importance: Undecided
       Status: New

** No longer affects: ubuntu

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1328821

Title:
  nginx not rotating logs

To manage notifications about this bug go to:
https://bugs.launchpad.net/nginx/+bug/1328821/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to