|
Home > Archive > Apache Server configuration support > January 2007 > httpd.conf - How to capture only 500 internal server errors?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
httpd.conf - How to capture only 500 internal server errors?
|
|
| Shekar 2007-01-25, 7:27 pm |
| Hello,
Is there any way to configure httpd.conf file to capture only 500
errors?
I have put in the following entries in httpd.conf file:
LogFormat "%500t %500U %500q %500h %500u \"%500r\" %500s
\"%500{Cookie}i\" \"%500{Referer}i\" \"%500{User-agent}i\""
logging500errors
CustomLog logs/apache/access_log-500 logging500errors
but this seem to insert dummy entries for all other request outputs
(e.g - - - - - "-" - "-" "-" "-")
I want to know if there is a better way to get this done.
Thanks in advance for all your help.
- Shekar
| |
| Davide Bianchi 2007-01-25, 7:27 pm |
| On 2007-01-25, Shekar <ctippur@gmail.com> wrote:
> Is there any way to configure httpd.conf file to capture only 500
> errors?
The first thing that came to my mind is to use a SetEnvIf directive
to capture the error code and set a 'flag' if that is a 500, then
use conditional logging to log only that.
See the documentation about SetEnvIf and Conditional Logging if that
is what you need.
Davide
--
Q: What's another name for the "Intel Inside" sticker they put on Pentiums?
A: Warning label.
| |
| Shekar 2007-01-25, 7:27 pm |
| I tried this and it did not work:
LogFormat "%t %U %q %h %u \"%r\" %s \"%{Cookie}i\" \"%{Referer}i\"
\"%{User-agent}i\"" logging500errors
SetEnvIf status 404 500env
CustomLog logs/apache/access_log_pod-500 logging500errors env=500env
What is the SetEnvIf directive to capture the return status?
NOTE: I tested 404 because it is easy to recreate.
- Shekar
On Jan 25, 11:37 am, Davide Bianchi <davideyeahs...@onlyforfun.net>
wrote:
> On 2007-01-25, Shekar <ctip...@gmail.com> wrote:
>
> to capture the error code and set a 'flag' if that is a 500, then
> use conditional logging to log only that.
>
> See the documentation aboutSetEnvIfand Conditional Logging if that
> is what you need.
>
> Davide
>
> --
> Q: What's another name for the "Intel Inside" sticker they put on Pentiums?
> A: Warning label.
| |
| shimmyshack 2007-01-26, 1:41 am |
|
On 26 Jan, 00:31, "Shekar" <ctip...@gmail.com> wrote:[vbcol=seagreen]
> I tried this and it did not work:
>
> LogFormat "%t %U %q %h %u \"%r\" %s \"%{Cookie}i\" \"%{Referer}i\"
> \"%{User-agent}i\"" logging500errors
>
> SetEnvIf status 404 500env
> CustomLog logs/apache/access_log_pod-500 logging500errors env=500env
>
> What is the SetEnvIf directive to capture the return status?
>
> NOTE: I tested 404 because it is easy to recreate.
>
> - Shekar
>
> On Jan 25, 11:37 am, Davide Bianchi <davideyeahs...@onlyforfun.net>
> wrote:
>
>
>
>
>
Another way:
..
Here's a command that will find your 500 errors
from either HTTP/1.0 or HTTP/1.1 requests in the access.log
grep -e "1\.[0|1][\"] 500 " access.log
its fast and you could send the results to a file by adding
grep -e "1\.[0|1][\"] 500 " access.log > 500_errors.log
It's just as easy in my view, since if you are going to look at those
errors you could have the thing in a little script, and just execute
it, you could have it open an editor with the results in, or email you
with them at a preset time using cron.
You could even use dif to compare the results this time with the
results last time (if you dont rotate your log file) and send that by
email...
|
|
|
|
|