This is a discussion on httpd.conf - How to capture only 500 internal server errors? within the Apache Web Server forums, part of the Web Server and Related Forums category; Hello, Is there any way to configure httpd.conf file to capture only 500 errors? I have put in the ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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: > > > 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 aSetEnvIfdirective > 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. |
|
|||
|
On 26 Jan, 00:31, "Shekar" <ctip...@gmail.com> wrote: > 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: > > > > 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 aSetEnvIfdirective > > 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. 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... |
| Thread Tools | |
| Display Modes | |
|
|