Friday, January 21, 2011

How To Suppress Apache Error

I've gone through the trouble of blocking a number of bots that are trying to crawl our site. The issue now is that the following error is taking over the apache error log:

client denied by server configuration

I was hoping that an Apache expert out there can tell me how I can suppress the error message for this specific issue from being written to the error log.

Thanks in advance for your help!

  • grep -v

    Really. I mean it. Why manipulate the logs at time of writing?

    Edit 1

    tail -f -n100 /var/log/httpd/error_log | grep -v 'client denied by server configuration'

    If you really want to prevent the error from being written to disk, you can pipe your logs through a script. More details here:

    Apache docs

    Russell C. : @Warner - Fair enough. Any ideas how I can change the following command I currently use to view the log file so that it suppresses those errors? tail -100 /etc/httpd/logs/error_log
    Russell C. : @Warner - Thanks! That seems to produce something slightly different since it first grabs 100 lines of the error log and then only shows non-matching lines. Is there a way to instead display the last 100 lines that don't match?
    Warner : Try this: `grep -v 'client denied by server configuration' /etc/httpd/logs/error_log | tail -n100`
    Russell C. : @Warner - works great. Thanks for the help!
    From Warner

0 comments:

Post a Comment