You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jarl Friis <ja...@inseeto.com> on 2010/05/05 11:09:50 UTC

[users@httpd] Send email upon HTTP response 500

Hi.

I am looking for a module that can send me emails every time a HTTP
500 Response is returned to the user. The point is that I am hosting a
(rails) web-application and I would like to get notified every time
something went wrong.

I have looked at mod_tee, which could probably do the job, however it
seems very unmature. Then mod_diagnostics, but that seems mostly for
debugging other modules.

I also seem to remember that apache httpd can send email on certain
events (reponse 500) even without an additional module. But searching
for "apache send email" is useless as these words are all over the
internet.

Please help.

Jarl


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Send email upon HTTP response 500

Posted by Jarl Friis <ja...@inseeto.com>.
Jarl Friis <ja...@inseeto.com> writes:

> Nick Kew <ni...@webthing.com> writes:
>
>> On 5 May 2010, at 10:09, Jarl Friis wrote:
>>
>>> Hi.
>>> 
>>> I am looking for a module that can send me emails every time a HTTP
>>> 500 Response is returned to the user.
>>
>> Why not hook that in to the logging?
>
> I think I got it... 
>
> Use 'SetEnvIf' directive to detect response 500
> Use the pipe feature of CustomLog and log conditionally.

Well, so I thought. Experimenting a bit and reading the documentation
for SetEnvIf
(http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html#SetEnvIf) I
see that I cannot set a variable based on any information from the
response. Only request information is available.

Too bad. 

I could of course make my own distiller script that recognises
response 500 and send emails in that case, but that will drown the
server I guess if every request shall go through a new instance of
bash,sed,perl or something like that.

Back to square one. Any help is appreciated.

Jarl


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Send email upon HTTP response 500

Posted by Jarl Friis <ja...@inseeto.com>.
Nick Kew <ni...@webthing.com> writes:

> On 5 May 2010, at 10:09, Jarl Friis wrote:
>
>> Hi.
>> 
>> I am looking for a module that can send me emails every time a HTTP
>> 500 Response is returned to the user.
>
> Why not hook that in to the logging?

I think I got it... 

Use 'SetEnvIf' directive to detect response 500
Use the pipe feature of CustomLog and log conditionally.

Thanks a lot for the hint!

Jarl


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Send email upon HTTP response 500

Posted by Jarl Friis <ja...@inseeto.com>.
Hi Nick.

Thank you for your time.

Nick Kew <ni...@webthing.com> writes:

> On 5 May 2010, at 10:09, Jarl Friis wrote:
>
>> Hi.
>> 
>> I am looking for a module that can send me emails every time a HTTP
>> 500 Response is returned to the user.
>
> Why not hook that in to the logging?

Do you mean the appache httpd logging feature? Is that so flexible
that logging could be done to an email recipient when specific
criterias are satisfied?

Could you ellaborate?

Jarl


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Send email upon HTTP response 500

Posted by Nick Kew <ni...@webthing.com>.
On 5 May 2010, at 10:09, Jarl Friis wrote:

> Hi.
> 
> I am looking for a module that can send me emails every time a HTTP
> 500 Response is returned to the user.

Why not hook that in to the logging?

> I have looked at mod_tee, which could probably do the job, however it
> seems very unmature. Then mod_diagnostics, but that seems mostly for
> debugging other modules.

mod_tee was written to enable HTTP responses to be duplicated in email
in a particular situation (User wants email copy of a report).  It works for
that, but would take more work and testing to realise its potential as a
more general-purpose module.  If you think it might meet your needs,
try it and see!

-- 
Nick Kew

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org