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.

So, whenever a user tries to fetch a file on my Apache server that doesn't exist I get a 404 line in the Access log:

[29/Sep/2010:12:14:45 +0200] "GET /asdf HTTP/1.1" 404

And I also get this in the Error log:

[Wed Sep 29 12:14:45 2010] [error] [client] File does not exist: /www/site/asdf

Is there a way to suppress 404 erros from showing up in the error log- only in the access log?

share|improve this question

4 Answers 4

ErrogLog(http://httpd.apache.org/docs/2.2/mod/core.html#errorlog) have not conditional. You can send the logs to syslog or script and filter it.

share|improve this answer

Try experimenting with LogLevel directive (http://httpd.apache.org/docs/current/mod/core.html#loglevel). It's not exactly what you want, but it can suit you needs, nevertheless

share|improve this answer
    
LogLevel seems to be set to always be notice when logging to a flatfile, though... :( –  Sandman Sep 29 '10 at 14:01

Yes, you can suppress them from the error log, but still have them in the access log. Just add these lines to .htaccess:

# Don't log missing files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(content\asdf)$ - [R=404,L]

It uses mod_rewrite.

RewriteCond is there to make sure that file indeed doesn't exist. Files that do exist will be served as usual.

R=404 says to send 404 Not Found status code when client accesses any files that contain "asdf". You need to modify the expression in parenthesis, on the last line, to suit your needs.

This answer is also found here.

share|improve this answer

Error 404 is defined in defined in httpd.conf or .htacces like so:

ErrorDocument 404 /404.html

You can redirect to index page :

ErrorDocument 404 /index.html

or you can create a blank page blank.html and change config to : ErrorDocument 404 /blank.html

share|improve this answer
2  
I don't think you understand the question. –  cwd Nov 9 '11 at 18:46

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.