Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

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

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
1  
You don't need to shutdown nginx, just send USR1 signal. –  VBart Dec 15 '12 at 0:44

Your Answer

 
discard

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.