Re: monitoring HTTP Error Codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you Scott, I knew about .htacess but was not sure that it is supported over "server config" context in apache.






On Mon, Oct 19, 2009 at 2:46 AM, Scott Haneda <talklists@xxxxxxxxxx> wrote:
Set your Error Document directive:
http://httpd.apache.org/docs/2.0/mod/core.html#errordocument

ErrorDocument 404 /place/mailer.php
ErrorDocument 406 /place/mailer.php
ErrorDocument 500 /place/mailer.php
ErrorDocument 501 /place/mailer.php

In mailer.php, or whatever scripting language you chose to use, you will have code that sends an email.  I would be careful, this can get a little out of hand, and you will get a lot of emails.

I may be inclined to do something like this: (pseudo code)

no_mail_arr = array('google', 'bing', etc etc etc)
if (user_agent not in array)
       $message = the headers + the page name + the url + the agent + referrer
       mail(someone@xxxxxxxxxxx 'error on page $page', $message)
end if

In reality, I think it would be better to just set up a custom logging directive, and log any http you desire, to a special log, with all the data you need. Run that log through any good stats software, and you will be much better off.

--
Scott * If you contact me off list replace talklists@ with scott@ *


On Oct 18, 2009, at 1:28 PM, MadTh wrote:

Please advise on how can we monitor HTTP Error Codes on a web server and then send an email alert upon errors.

The HTTP Error Codes we need alerts on are 404,406,500 and 501 errors

We do not want to monitor it for a particular site, but serverwide.  So we need to find some way to pull the details from apache error log ( /etc/httpd/logs/error_log


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
 "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux