1

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

quanta
  • 50,327
  • 19
  • 152
  • 213
shendz
  • 111
  • 1
  • 2

2 Answers2

1

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

Mark Stosberg
  • 3,771
  • 23
  • 27
0

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)

alexgirao
  • 101
  • 1