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([email protected] '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: [email protected]
" from the digest: [email protected]
For additional commands, e-mail: [email protected]