You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mike Cardwell <ap...@lists.grepular.com> on 2009/08/31 23:00:26 UTC

[users@httpd] Passing variables to ErrorLog pipe

Hi,

I'm using a pipe for my error log like this:

ErrorLog "|/web/etc/log_error_pipe.pl"

Is there any way of passing information to the pipe other than the log 
entry? Specifically I'd like to pass the HTTP_HOST value to it...

-- 
Mike Cardwell - IT Consultant and LAMP developer
Cardwell IT Ltd. (UK Reg'd Company #06920226) http://cardwellit.com/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Passing variables to ErrorLog pipe

Posted by Mike Cardwell <ap...@lists.grepular.com>.
Mike Cardwell wrote:

> I'm using a pipe for my error log like this:
> 
> ErrorLog "|/web/etc/log_error_pipe.pl"
> 
> Is there any way of passing information to the pipe other than the log 
> entry? Specifically I'd like to pass the HTTP_HOST value to it...

I came up with a pretty sick solution. I set the ErrorLog to log to 
syslog rather than a pipe.

Using syslog gives the error log one extra piece of useful information 
which is the pid of the apache child. It also contains the client IP and 
time.

So I set the CustomLog to log to a pipe, and updated the LogFormat to 
include the pid, start time and end time.

So if the error log entry has a time inbetween the start/end time of the 
access log entry, and it shares the same client ip and pid, then I can 
link it to a particular access log entry.

I have a script tailing the syslog file gathering error log information, 
and listening on a udp port for the CustomLog pipe process to send 
packets containing pid/ip/start_time/end_time/HTTP_HOST

-- 
Mike Cardwell - IT Consultant and LAMP developer
Cardwell IT Ltd. (UK Reg'd Company #06920226) http://cardwellit.com/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org