Logging CGI response size (Apache 1.3.9)

Logging CGI response size (Apache 1.3.9)

Post by Ed Thomso » Tue, 26 Oct 1999 04:00:00



Hello-

I'm in need of a way to log the size of responses from CGIs using Apache
1.3.9.  With our combined-style custom log format, %b is set to '-' in our
logfiles for CGI responses.  Therefore, we have no idea how much data
is actually being sent for these responses.

Is there any way to have the actual size of the CGI generated output logged
in the log file?  The Apache FAQ doesn't seem to mention if this is possible
or not.  I apologize if this comes up often, my news server expires articles
quickly.

Sincerely,

 
 
 

Logging CGI response size (Apache 1.3.9)

Post by Marc Slem » Tue, 26 Oct 1999 04:00:00



>Hello-

>I'm in need of a way to log the size of responses from CGIs using Apache
>1.3.9.  With our combined-style custom log format, %b is set to '-' in our
>logfiles for CGI responses.  Therefore, we have no idea how much data
>is actually being sent for these responses.

Erm... not for me:

207.167.15.58 - - [25/Oct/1999:16:33:17 -0600] "GET /~marcs/ulimit.cgi HTTP/1.0" 200 415

Is there something special about your CGIs?

Are you using any modifications to Apache?

Are you positive you are using 1.3.9?

 
 
 

Logging CGI response size (Apache 1.3.9)

Post by Ed Thomso » Tue, 26 Oct 1999 04:00:00



> Erm... not for me:
> 207.167.15.58 - - [25/Oct/1999:16:33:17 -0600] "GET /~marcs/ulimit.cgi HTTP/1.0" 200 415
> Is there something special about your CGIs?

Yep -- after more careful examination, I realized that I was looking at nph-
scripts in disguise.  I'm off to now hack mod_cgi to disable nph scripts.

I'll put my crackpipe away now.

Thanks,
Ed

 
 
 

Logging CGI response size (Apache 1.3.9)

Post by Colin Haxt » Wed, 27 Oct 1999 04:00:00


Are you going through a proxy server ?  Quite often proxies will
report actual volumes.

Colin

On 25 Oct 1999 16:05:49 -0500, Ed Thomson


>Hello-

>I'm in need of a way to log the size of responses from CGIs using Apache
>1.3.9.  With our combined-style custom log format, %b is set to '-' in our
>logfiles for CGI responses.  Therefore, we have no idea how much data
>is actually being sent for these responses.

>Is there any way to have the actual size of the CGI generated output logged
>in the log file?  The Apache FAQ doesn't seem to mention if this is possible
>or not.  I apologize if this comes up often, my news server expires articles
>quickly.

>Sincerely,


-------------------------------
Colin Haxton
Arena Consulting Limited

Providing
 --> Log Monitoring
 --> Unix System Monitoring
 --> Protected Web Server
outsource services.

http://www.arena.co.nz/
===============================

 
 
 

Logging CGI response size (Apache 1.3.9)

Post by Marc Slem » Thu, 28 Oct 1999 04:00:00




>> Erm... not for me:

>> 207.167.15.58 - - [25/Oct/1999:16:33:17 -0600] "GET /~marcs/ulimit.cgi HTTP/1.0" 200 415

>> Is there something special about your CGIs?

>Yep -- after more careful examination, I realized that I was looking at nph-
>scripts in disguise.  I'm off to now hack mod_cgi to disable nph scripts.

Or you can just have it log what they output.  The reason it doesn't now
is because the bytes are only supposed to include the body, while it
doesn't know about headers vs. body for nph- scripts so what it logged
for them would include the header.

Index: mod_cgi.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_cgi.c,v
retrieving revision 1.93
diff -u -r1.93 mod_cgi.c
--- mod_cgi.c   1999/10/21 20:45:22     1.93

     }

     if (script_in && nph) {
+       /* well, this will make bytecount include headers but oh well... */
+       r->sent_bodyct = 1;
        ap_send_fb(script_in, r);
     }