From apwww@hyperreal.org Sat Aug 23 20:43:17 1997 Received: (from apwww@localhost) by hyperreal.org (8.8.5/8.8.5) id UAA13219; Sat, 23 Aug 1997 20:43:17 -0700 (PDT) Message-Id: <199708240343.UAA13219@hyperreal.org> Date: Sat, 23 Aug 1997 20:43:17 -0700 (PDT) From: David Birnbaum Reply-To: davidb@chelsea.net To: apbugs@hyperreal.org Subject: Logging of virtual server to error_log as well X-Send-Pr-Version: 3.2 >Number: 1050 >Category: mod_log-any >Synopsis: Logging of virtual server to error_log as well >Confidential: no >Severity: non-critical >Priority: medium >Responsible: apache >State: suspended >Class: change-request >Submitter-Id: apache >Arrival-Date: Sat Aug 23 20:50:01 1997 >Originator: davidb@chelsea.net >Organization: >Release: 1.2.x >Environment: Solaris 2.5.1 >Description: I have written some perl scripts to allow my apache server to run any number of virtual servers under Solaris. The script also allows for splitting out access_log files to for each server by adding the %v option to the CustomLog directive. The question - would it be possible to allow the %v option to apply to the error_log as well? That would be very convenient, as we want to give our clients access to their error_log for debugging CGI script problems and looking for missing files, but unfortunately they have to look at the error_log for the entire server. I'm going to post the scripts to the web as soon as they've been tested a bit more - it's nothing too special really, just a cascading PERL job for every 200 FD, and probably none too efficient, but it works dandy for these big low/ medium usage multiple VD servers. >How-To-Repeat: >Fix: Either allow a CustomErrorLog directive, or perhaps a very simple VirtualErrorLog which puts the virtual server name as a leader in the error log: www.foo.com: access to /usr/local/httpd/DOMAINS... >Audit-Trail: State-Changed-From-To: open-suspended State-Changed-By: marc State-Changed-When: Sun Aug 24 15:59:12 PDT 1997 State-Changed-Why: Unfortunately, it isn't that easy to do something like this. There are a lot of different places messages can come from and they are not in a standardized form. Also, any stderr from CGIs goes to the error log and we can't control that. There are a few things that could be done to help a bit, but I'm not aware of anyone planning to do so in the forseeable future. From: Marc Slemko To: David Birnbaum Subject: Re: mod_log-any/1050: Logging of virtual server to error_log as well Date: Sun, 24 Aug 1997 23:11:05 -0600 (MDT) On Mon, 25 Aug 1997, David Birnbaum wrote: > If you have the ErrorLog in a VirtualHost directive, then error message > from that particular virtual server (including STDERR, which is waht I'm > really interested in) go to that log. I guess all that I really would > want is some way to prepend the name of the virtual host to any of those > error strings. I don't understand how you bind a particular error message > to a given output, but since it is done somewhere in the VirtualHost code, > it seems as though that same mechanism could be used. Not really. All that is done is a different file descriptor is for the log. The CGI is run with stderr pointing to that file. Apache isn't in the loop any more. All that can be done easily is mess with what file descriptor gets the output, we can't edit it in-stream. There are various workarounds and ways to do something like this, but it isn't an easy change. From: David Birnbaum To: Marc Slemko Subject: Re: mod_log-any/1050: Logging of virtual server to error_log as well Date: Mon, 25 Aug 1997 01:28:19 -0400 (EDT) On Sun, 24 Aug 1997, Marc Slemko wrote: > On Mon, 25 Aug 1997, David Birnbaum wrote: > > > If you have the ErrorLog in a VirtualHost directive, then error message > > from that particular virtual server (including STDERR, which is waht I'm > > really interested in) go to that log. I guess all that I really would > > want is some way to prepend the name of the virtual host to any of those > > error strings. I don't understand how you bind a particular error message > > to a given output, but since it is done somewhere in the VirtualHost code, > > it seems as though that same mechanism could be used. > > Not really. All that is done is a different file descriptor is for the > log. The CGI is run with stderr pointing to that file. Apache isn't in > the loop any more. All that can be done easily is mess with what file > descriptor gets the output, we can't edit it in-stream. Hmmm...I see. That makes sense; too bad there's not another way to get around it. I suppose one could attach STDERR of the CGI process to a pipe on the httpd process and read it in that way to do the formatting, but that's a bit of code to put together, not to mention the possibility of deadlock to account for, since forking a child to handle it would be somewhat silly. Perhaps I'll dust off what's left of my C that hasn't been completely PERL'ized and see if I can make it do that.... Thanks for the information, as well as a great server, David. >Unformatted: >Last-Modified: Sun Aug 24 15:59:12 PDT 1997