Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to enhance my logfile with an additional field containing the mime type. E.G. - - [01/Mar/2012:20:49:36 +0100] "GET / HTTP/1.1" 200 255 [...] "text/html" - - [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.

share|improve this question
up vote 4 down vote accepted

You can log any header field that is present in the response, like so: %{HEADER_NAME}i.

Refer to the Custom Log Formats documentation for details.

share|improve this answer
I guess the header you would want would be Content-Type: so in CustomLog: "%{Content-Type}i". It does contain more than just the MIME type, however. Wrapped in quotes because the header can contain spaces. – Ladadadada Mar 8 '12 at 10:13
The "i" at the end of {HEADER_NAME} is wrong, but I figured out that I need to replace it with an "o". (like "incoming" and "outgoing") – mawimawi Mar 8 '12 at 11:39
Ah, excellent, sorry about that. – adaptr Mar 8 '12 at 12:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.