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.

What I am trying to do: Log rotate nginx access and error log using multilog

My approach: Log nginx access and error to a pipe, so I can have another process that runs multilog that reads from that pipe and let multilog to do the log rotation

nginx.conf

access_log /var/log/nginx/access/pipe;
error_log /var/log/nginx/access/pipe;

I make sure I created the pipe and give enough permission to whoever to do anything with it

$ sudo mkfifo /var/log/nginx/access/pipe /var/log/nginx/error/pipe
$ sudo chmod a+rwx /var/log/nginx/access/pipe /var/log/nginx/error/pipe

However, when I start nginx, it will hang as if it is waiting for stdin or something. I might be missing something here.

I tried simple echo to the pipe

$ echo a > /var/log/nginx/access/pipe

and it also hangs as if it is waiting for more input. Mayb

share|improve this question
    
Did you edit the init script to start multilog before the Nginx? –  quanta Aug 8 '12 at 8:29
add comment

2 Answers

this project solves it by properly binding svlogd and nginx semantics, it has a chargen program that simulate nginx behaviour, a stress test and a runit/runsv/svlogd integration example

project tagline: nginx log rotation with daemontools/runit (multilog/svlogd respectively)

share|improve this answer
add comment

I think multilog needs to be listening to the pipes before you start Nginx.

share|improve this answer
add comment

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.