%D field in Apache access logs - first or last byte?

skaffman picture skaffman · Jan 19, 2011 · Viewed 13.4k times · Source

The Apache Httpd manual has a section on custom access log formats. One of these options is the %D field, which is documented as

The time taken to serve the request, in microseconds.

Can anyone tell me what exactly this is measuring? Is it time-to-first-byte, or time-to-last-byte, for example, or something more complex than that?

I need this is demonstrate compliance to performance requirements, and I want to know exactly what's being measured here.

Answer

noodl picture noodl · Jan 19, 2011

It's the last byte or rather, apr_time_now() - request_rec->request_time which is worked out during the logging phase. That phase happens last in the processing cycle, after the response has been sent.