[TriLUG] OT - Apache access_log ignore request

Aaron S. Joyner aaron at joyner.ws
Tue Apr 6 11:00:01 EDT 2004


The problem here is that Request_URI matches only against the URI - in 
other words the portion after the host name, before the question mark.  
Everything after the question mark is considered to be part of the 
Query_String.  You might consider trying to do multiple matches to get 
precisely the behavior you want, something like this:

SetEnvIf Request_URI "/servlet/STestWebServer" ignore1
SetEnvIf Query_String "COMMAND=TEST" ignore2
CustomLog /logs/http/OrderStatus/access_log common env=!ignore1 env=!ignore2

More detail here: 
http://httpd.apache.org/docs/mod/mod_setenvif.html#setenvif

I'm not sure you can have multiple env's, or how you can combine them - 
the docs aren't clear about that.  You might also want to try something 
like env=!ignore[12] or some other hopeful variation.  It may also be 
possible to do further testing with SetEnvIf on ignore1 and ignore2 to 
set ignore3, and then ignore based on that variable.  Some 
experimentation may be required.  :)

Aaron S. Joyner

Howard Boyd II wrote:

>I have an application that is sending a request to my Apache server and
>the request is filling up the access_log. The entry in the access_log
>looks like:
>
><ip of sender> - - [06/Apr/2004:10:00:09 -0400] "GET
>/servlet/STestWebServer?COMMAND=TEST HTTP/1.0" 200 3
>
>I would like to modify my httpd.conf file to ignore logging of these
>specific requests. Ideally, I would like to ignore logging any request
>of the form "/servlet/STestWebServer?COMMAND=TEST". I have modified the
>httpd.conf file as follows:
>
># Configure to Ignore Unnecessary log records
>SetEnvIf Request_URI "/servlet/STestWebServer" ignore
>...
>
>CustomLog /logs/http/OrderStatus/access_log common env=!ignore
>
>The above works for me but isn't the exact pattern. If I modify the
>above to:
>
># Configure to Ignore Unnecessary log records
>SetEnvIf Request_URI "/servlet/STestWebServer?COMMAND=TEST" ignore
>...
>
>CustomLog /logs/http/OrderStatus/access_log common env=!ignore
>
>It doesn't work. The pattern matching fails.
>
>I'm assuming this has something to do w/ special characters (the
>question mark?)? I've tried escaping things and various other tricks to
>no avail. Could someone please tell me how to match the pattern exactly?
>Thanks!
>
>Howard
>
>
>***********************************
>*    In my dreams, your dreams come true.
>*    Song: In My Dreams 
>*    Artist: Josh Turner
>*    CD: Long Black Train
>***********************************
>
>
>
>  
>




More information about the TriLUG mailing list