Re: [users@httpd] turn off error_log formatting under standard cgi handler?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Apparently there's not a damn thing I can do about it:

http://httpd.apache.org/docs/2.0/logs.html

"The first item in the log entry is the date and time of the
message. The second entry lists the severity of the error being
reported. The LogLevel directive is used to control the types of
errors that are sent to the error log by restricting the
severity level. The third entry gives the IP address of the
client that generated the error. ... It is not possible to
customize the error log by adding or removing information."

WHY WHY WHY?

This works well for me as an error log pipe, at least while I'm 
developing.  

#!/usr/bin/perl

use strict;
use warnings;

open LAME, '>>', '/var/log/apache2/lame.log';

select LAME;
$| = 1;

while (<STDIN>) {
    s{ \A \[.*?\] \s* \[.*?\] \s* \[.*?\] }{}xms;
    s{ , \s referer: \s http:// .*? \z }{}xms;
    print LAME $_;
}


Mark


On Fri, 11 Aug 2006, Mark Hedges wrote:

> From: Mark Hedges <hedges@xxxxxxxx>
> Reply-To: users@xxxxxxxxxxxxxxxx
> To: users@xxxxxxxxxxxxxxxx
> Date: Fri, 11 Aug 2006 15:22:36 -0700 (PDT)
> Subject: [users@httpd] turn off error_log formatting under standard cgi
>     handler?
> 
> 
> Server: Apache/2.0.55 (Debian) mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 Perl/v5.8.8
> 
> Using the regular cgi handler (no mod_perl fancy stuff), my 
> warning messages have this format:
> 
> [Fri Aug 11 13:25:03 2006] [error] [client 127.0.0.1] ---, referer: http://localhost/the_http_referer_page.html
> 
> The problem is that the referer is listed after EVERY line of STDERR output.
> If I warn a multi-line output (for example, a data structure dump), then
> every line of that warning gets the referer tagged on.
> 
>     warn qq{
>         This
>         is
>         a
>         test
>         of
>         the
>         emergency
>         broadcast
>         system.
>     };
> 
> [Fri Aug 11 15:14:46 2006] [error] [client 127.0.0.1] , referer: http://localhost/cgi-bin/mycart.cgi
> [Fri Aug 11 15:14:46 2006] [error] [client 127.0.0.1]         This, referer: http://localhost/cgi-bin/mycart.cgi
> [Fri Aug 11 15:14:46 2006] [error] [client 127.0.0.1]         is, referer: http://localhost/cgi-bin/mycart.cgi
> [Fri Aug 11 15:14:46 2006] [error] [client 127.0.0.1]         a, referer: http://localhost/cgi-bin/mycart.cgi
> [Fri Aug 11 15:14:46 2006] [error] [client 127.0.0.1]         test, referer: http://localhost/cgi-bin/mycart.cgi
> [Fri Aug 11 15:14:46 2006] [error] [client 127.0.0.1]         of, referer: http://localhost/cgi-bin/mycart.cgi
> [Fri Aug 11 15:14:46 2006] [error] [client 127.0.0.1]         the, referer: http://localhost/cgi-bin/mycart.cgi
> [Fri Aug 11 15:14:46 2006] [error] [client 127.0.0.1]         emergency, referer: http://localhost/cgi-bin/mycart.cgi
> [Fri Aug 11 15:14:46 2006] [error] [client 127.0.0.1]         broadcast, referer: http://localhost/cgi-bin/mycart.cgi
> [Fri Aug 11 15:14:46 2006] [error] [client 127.0.0.1]         system., referer: http://localhost/cgi-bin/mycart.cgi
> [Fri Aug 11 15:14:46 2006] [error] [client 127.0.0.1]      at /usr/lib/cgi-bin/mycart.cgi line 57., referer: http://localhost/cgi-bin/mycart.cgi
> 
> 
> It makes warnings and debugging statements immensely difficult to read.  
> 
> Is there some way to turn it off?  It's really annoying.
> I'm used to mod_perl, which does not do this.
> 
> This doesn't happen when I run the script under a mod_perl2 handler
> like ModPerl::Registry or anything else.  In that case, warnings 
> print normally to the error log without any additional information.
> 
> My conf file section:
> 
>     ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
>     <Directory "/usr/lib/cgi-bin">
>         AllowOverride None
>         Options +ExecCGI -MultiViews +FollowSymLinks
>         Order allow,deny
>         Allow from all
>     </Directory>
> 
> Ideally, I would like to turn off the first part of each line too, 
> with the date, warning level and client IP.
> 
> Any clues how I can change this behavior?  Do I have to write my 
> own handler to pipe the ErrorLog output to?
> 
> Mark
> 
> ---------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxx
>    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> 
> 

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux