Apache piping log to netcat fails
Solution 1:
Apache docs: http://httpd.apache.org/docs/2.2/logs.html#piped
Apache will start the piped-log process when the server starts, and will restart it if it crashes while the server is running. (This last feature is why we can refer to this technique as "reliable piped logging".)
NC docs: man nc
-w timeout Connections which cannot be established or are idle timeout after timeout seconds. The -w flag has no effect on the -l option, i.e. nc will listen forever for a connection, with or without the -w flag. The default is no timeout.
What you are seeing is Apache starting netcat with a timeout of 1 second. Regardless of if there is any log data, netcat then times out after one second (due to -w 1 option) and quits. Apache then restarts netcat. Lather, rinse, repeat.
I suggest removing -w 1
from the netcat command in this circumstance.
Stepping back, I would suggest using syslog for this function (not sure why you didn't go with it in the first place).