Is it possible to configure nginx to create a new access log for a given host per minute?

An external process/application will be reading from these log files, and I want to make sure there are no file locking issues etc., so if I can have nginx create a new log file every minute, this way I can make sure I don't touch the current minutes log file.

  • FYI there are no issues with locking when one process is reading and another process is writing the file. In my setup I have a perl script which continually reads the nginx logs and spits out per minute stats, and the log file are rotated every 24 hours.
    – Sameer
    Dec 1, 2012 at 3:58

2 Answers 2


Just going to quote from the developer here:

If you really want logging to an external process - try using mkfifo(1), but please keep in mind that this will lead to service interruption if your logging process won't be able to cope with load. I would recommend logging to a normal file and using "tail -F /path/to/log | script" instead if you need some log processing.

See also: Proper way to rotate Nginx logs


Nginx official documentation: Rotating Log-files

  • Thanks, but how do you "After that USR1 signal should be sent to the master process." ? Dec 11, 2012 at 18:40
  • See man kill - one of the most basic unix/linux commands.
    – VBart
    Dec 11, 2012 at 21:48
  • Also nginx -s reopen (see man nginx)
    – VBart
    Dec 11, 2012 at 23:56
  • so they are suggesting to actually shutdown the nginx server, so the site will be down for a split second during this log rotating process? Dec 14, 2012 at 21:25
  • 1
    You don't need to shutdown nginx, just send USR1 signal.
    – VBart
    Dec 15, 2012 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.