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

I know I am able to search for particular keywords in my Apache error_log file by using the grep command:

# grep "favicon.ico" error_log

I am curious though if it is possible to delete/remove any and all lines which contain specific keywords from a file.

I know this won't work but the idea is:

rm -r -f grep "favicon.ico" error_log
share|improve this question

1 Answer 1

up vote 2 down vote accepted
sed -i '/favicon.ico/d' error_log

But you can get rid of this error appearing in Apache error log by creating an empty favicon.ico file in document root or putting the following in the httpd.conf file:

Redirect 404 /favicon.ico

<Location /favicon.ico>
    ErrorDocument 404 "No favicon"
</Location>
share|improve this answer
    
thanks for the help. I did come across the last bit you added but giving several 404 errors seems like it would be bad for page ranking. –  JM4 Sep 20 '11 at 16:08

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.