Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.