Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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 '12 at 3:58

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

share|improve this answer

Nginx official documentation: Rotating Log-files

share|improve this answer
Thanks, but how do you "After that USR1 signal should be sent to the master process." ? – user1361315 Dec 11 '12 at 18:40
See man kill - one of the most basic unix/linux commands. – VBart Dec 11 '12 at 21:48
Also nginx -s reopen (see man nginx) – VBart Dec 11 '12 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? – user1361315 Dec 14 '12 at 21:25
You don't need to shutdown nginx, just send USR1 signal. – VBart Dec 15 '12 at 0:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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