Understanding %D in LogFormat for apache2 logs

A colleague recently asked me if %D, when used in your LogFormat for apache2 access logs includes the ‘download’ time of transmitting the response back to the client.

Following are observations from my apache2 access logs when using the %D format code. The first column is %D in the following log entries.

# 5 second pause on server side code. In this test case I deliberately induce a 5 second delay on server side code using the php sleep function. This delay can be seen in the timestamp (microseconds)
5003909 138.130.86.92 - - [11/Sep/2009:16:43:50 +1000] "GET /test.php HTTP/1.1" 200 139 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3"

# Static image open bandwidth. In this test case I let the browser download a static image as fast as my mobile broadband permits. The time takes approx 4.8 secs to download approx 900KB.
4860133 138.130.86.92 - - [11/Sep/2009:17:00:51 +1000] "GET /gorilla.jpg HTTP/1.1" 200 912128 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3"

# Static image restricted bandwidth. In this case I restrict the bandwidth to any destination port of 80 to 1KB/sec using ipfw[1]. This time it takes approx 12.8 secs to download the same file.
12891663 138.130.86.92 - - [11/Sep/2009:17:02:56 +1000] "GET /gorilla.jpg HTTP/1.1" 200 912128 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3"

[1] to restrict bandwidth on my mac I did this:
sudo ipfw pipe 1 config bw 1KByte/s
sudo ipfw add 1 pipe 1 dst-port 80
sudo ipfw delete 1

To sum up, when using %D in LogFormat for apache2, this timestamp is increased by any:
1. server side processing delays
2. delays attributed to restricted bandwidth etc

QED

1 comment to Understanding %D in LogFormat for apache2 logs

  • I think that %D is used for integers to store the numeric value in Apache log. I don’t know this concept deeply but this information helps me lot to understand this concept.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">