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. - - [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: Gecko/20101203 Firefox/3.6.13" 0/446

Hope it helps someone. Thanks/-


No comments:

Post a Comment

AWS re:Invent summary 2017

As you might know, this year’s AWS re:Invent was held @ Las Vegas 11/27 – 12/1.   Below links could be a good start to explore all ...