You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Peter Greis <pe...@netgen.com> on 1998/08/12 17:17:38 UTC

mod_log-any/2838: Enhancement to mod_log_config

>Number:         2838
>Category:       mod_log-any
>Synopsis:       Enhancement to mod_log_config
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          change-request
>Submitter-Id:   apache
>Arrival-Date:   Wed Aug 12 08:20:00 PDT 1998
>Last-Modified:
>Originator:     peter@netgen.com
>Organization:
apache
>Release:        1.3.1
>Environment:
SunOS new-york 5.6 Generic sun4u sparc SUNW,Ultra-1
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.2/specs
gcc version 2.7.2.2
>Description:
While the logging module allows for tracking the duration of a request, the time
granularity is too coarse for tracking software (such as ours). I have added
another configurable option which allows for millisecond granularity of
transaction durations. Optimally I would like to see this folded into the
released version of Apache.

cheers,

-peter
>How-To-Repeat:

>Fix:
add to httpd.conf:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"
\"-\" \"-\" %m" netgenesis
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"
\"-\" \"%{cookie}n\" %m" netgenesis_cookie

then somewhere below:

CustomLog /<...path to log file goes here...>/access_log netgenesis

The following generated with diff against 1.3.1 sources...

src/modules/standard/mod_log_config.c

138a139
>  * %...m:  the time taken to serve the request, in milli-seconds.
405a407,422
> /* Gather request timing down to the millisecond level, as just plain ol' seconds
> ** are useless for performance statistics
> */
> static const char *log_request_duration_fine(request_rec *r, char *a)
> {
>   long sec, msec, duration;
>   struct timeval t;
> 
>   gettimeofday(&t, NULL);
>   sec = t.tv_sec - r->request_time_fine.tv_sec; /* Seconds portion, usually zero */
>   msec = t.tv_usec - r->request_time_fine.tv_usec;
>   duration = sec * 1000.0 + msec / 1000.0;
> 
>   return ap_psprintf(r->pool, "%ld", duration);
> }
> 
453a471,473
>         'm', log_request_duration_fine, 1
>     },
>     {

src/main/http_protocol.c

668a669,672
> 
>       /* net.Genesis addition */
>       gettimeofday(&(r->request_time_fine), NULL);
> 
671a676,677
>     /* net.Genesis addition */
>     gettimeofday(&(r->request_time_fine), NULL);



>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <ap...@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]
[If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request ]
[from a developer.                                      ]
[Reply only with text; DO NOT SEND ATTACHMENTS!         ]