Monday, January 31, 2011

Apache: Track how much time a request took

To track the time taken to server a request by apache is just a matter of adding one extra parameter in your config file and this is how you do that -

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T/%D" combined

So if you see we have added only two additional parameters -

%T =
The time taken to serve the request, in seconds.
%D = The time taken to serve the request, in microseconds.

Once you make the config changes live by restarting your apache server, tail the access logs and you will now see the the time spent to serve the request at the end of the line, along with other access logs parameters.


172.28.90.21 - - [31/Jan/2011:21:29:15 -0800] "GET /repos/ HTTP/1.1" 401 401 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13" 0/446

Hope it helps someone. Thanks/-

-Debu

No comments:

Post a Comment

RCA - Root Cause Analysis

An important step in finding the root causes of issues or occurrences that happen within a system or organization is root cause analysis (RC...