Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Users

monitoring HTTP Error Codes

 

 

Apache users RSS feed   Index | Next | Previous | View Threaded


madan.feedback at gmail

Oct 18, 2009, 1:28 PM

Post #1 of 3 (317 views)
Permalink
monitoring HTTP Error Codes

Hi,

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 )


Thanks


talklists at newgeo

Oct 18, 2009, 2:16 PM

Post #2 of 3 (294 views)
Permalink
Re: monitoring HTTP Error Codes [In reply to]

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 [at] example '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 [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


madan.feedback at gmail

Oct 18, 2009, 2:24 PM

Post #3 of 3 (290 views)
Permalink
Re: monitoring HTTP Error Codes [In reply to]

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 [at] newgeo> 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 [at] example '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 [at] httpd
> " from the digest: users-digest-unsubscribe [at] httpd
> For additional commands, e-mail: users-help [at] httpd
>
>

Apache users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.