Insert MIME type of an URL into Apache’s access_log

apache-2.2log-filesloggingmime-type

I would like to enhance my logfile with an additional field containing the mime type.
E.G.

127.0.0.1 - - [01/Mar/2012:20:49:36 +0100] "GET / HTTP/1.1" 200 255 [...] "text/html"
127.0.0.1 - - [01/Mar/2012:20:49:37 +0100] "GET /x.gif HTTP/1.1" 200 1022 [...] "image/gif"

I could not find a standard field for this feature.

Best Answer

You can log any header field that is present in the response, like so: %{HEADER_NAME}o. In this case, %{Content-Type}o covers the MIME type as well.

Refer to the Custom Log Formats documentation for details.