27 messages in ru.sysoev.nginxRe: Feature request: Run a script whe...
FromSent OnAttachments
Rt IbmerApr 28, 2008 8:44 am 
Cliff WellsApr 28, 2008 10:20 am 
mikeApr 28, 2008 11:53 am 
Rt IbmerApr 28, 2008 2:02 pm 
Cliff WellsApr 28, 2008 2:18 pm 
Manlio PerilloApr 28, 2008 2:37 pm 
Rt IbmerApr 28, 2008 6:10 pm 
Rt IbmerApr 28, 2008 6:19 pm 
Manlio PerilloApr 29, 2008 1:18 am 
Manlio PerilloApr 29, 2008 1:25 am 
Rt IbmerApr 29, 2008 8:11 am 
François BattailApr 29, 2008 10:46 am 
Rt IbmerApr 29, 2008 1:41 pm 
Manlio PerilloApr 29, 2008 1:57 pm 
François BattailApr 29, 2008 2:27 pm 
Aleksandar LazicApr 29, 2008 2:36 pm 
François BattailApr 29, 2008 11:20 pm 
Mansoor PeerbhoyApr 30, 2008 1:46 am 
Manlio PerilloApr 30, 2008 2:36 am 
François BattailApr 30, 2008 3:54 am 
Mansoor PeerbhoyApr 30, 2008 5:03 am 
Grzegorz NosekApr 30, 2008 5:18 am 
Cliff WellsApr 30, 2008 10:40 am 
Manlio PerilloApr 30, 2008 12:16 pm 
Manlio PerilloMay 1, 2008 2:42 am 
Grzegorz NosekMay 1, 2008 11:28 am 
Manlio PerilloMay 1, 2008 12:02 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Feature request: Run a script when upstream detected down/upActions...
From:Manlio Perillo (manl@public.gmane.org)
Date:Apr 30, 2008 2:36:44 am
List:ru.sysoev.nginx

Mansoor Peerbhoy ha scritto:

hello,

i have a small suggestion to make (slightly off topic):

i think this problem would be best solvable by having nginx capable of logging
to a file-type other than a regular file. for instance, if the nginx error_log directive
(http://wiki.codemongers.com/NginxMainModule#error_log) could support a TCP/IP
or a unix domain socket or a named pipe, then interesting programs can be
written around it which may be an easy approach:

a) for instance, having an external program monitor nginx logs for a particular
log message (or "event"), is not so easy when the file in question is a regular
file. the reason for that is, regular files are *always* ready to read on linux
(even if the FD is at EOF), so you can't use an open file descriptor to a
regular file in a select()/poll() system call and expect it to work the way you
want. (i.e. ready-to-read) it could be done (tail -f does that), but it's rather messy to have a
file-change notification, plus seeking to the appropriate offset. -- with
sockets/fifos, these problems can go away. you can set up a socket server to
listen on the given socket for connections, and when nginx starts up, the error
log initialization code can connect to the tcp or unix domain socket or fifo in
question, and then all calls to nginx_log_* will naturally be written to the
socket, instead of written to a regular file

This is not as easy as it seems. First of all with the current architecture of Nginx, writing to the error log is assumed to be synchronous.

This means that if you want to send log messages to a TCP server the performance will be bad.

You can use an UDP connection, but what happens if Nginx sends data more quickly then the server is able to read? UDP has no flow control.