Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Is there a way to prevent apache from filling up the log file with pointless error messages like 404's and only display real errors?

share|improve this question

Yes, this can be done.

For that you need to use the Apache module mod_log_config.

Particular items can be restricted to print only for responses with specific HTTP status codes by placing a comma-separated list of status codes immediately following the "%". The status code list may be preceded by a "!" to indicate negation.

Format String Meaning

   %400,501{User-agent}i    Logs User-agent on 400 errors and 501 errors only. For other status codes, the literal string "-" will be logged. 

   %!200,304,302{Referer}i  Logs Referer on all requests that do not return one of the three specified codes, "-" otherwise.

The links is here.

share|improve this answer

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.