On 22.07.2014 16:22, Dames, Kristopher J wrote:
Kris,
On 7/21/14, 6:43 PM, Dames, Kristopher J wrote:
Can anyone point me to an example of conditional logging in Tomcat
6? Here is what I have tried to no avail. I want requests that
match /*/iaahb to not be logged.
In my server.xml:
<Valve className="org.apache.catalina.valves.AccessLogValve"
condition="DoNotLog" directory="logs" fileDateFormat="yyyy-MM-dd"
pattern="%{X-Forwarded-For}i %h %l %u %t "%r" %s %b
"%{Referer}i" "%{User-Agent}i""
prefix="access_log"/>
in my web.xml:
<!-- Custom filter to prevent logging health check requests -->
<filter> <filter-name>Set Do Not Log Attribute</filter-name>
<filter-class>SetDoNotLogFilter</filter-class> <init-param>
<param-name>DoNotLog</param-name> <param-value>true</param-value>
</init-param> </filter> <filter-mapping> <filter-name>Set Do Not
Log Attribute</filter-name> <url-pattern>/*/iaahb</url-pattern>
</filter-mapping>
On the face of it, this looks like it should work. What does your
"SetDoNoLogFilter" code look like?
As Mark Eggers already said: you can also use the Tuckey
UrlRewriteFilter to set the chosen request attribute "DoNotLog" for you.
See for example
http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/4.0/index.html#set
I haven't tried it but something like
<rule>
<from casesensitive="true">^/[^/]*/iaahb$</from>
<set name="client">DoNotLog</set>
</rule>
Note that for TC 7 there's also a conditionIf and conditionUnless, which
makes it a bit easier, if you need to revert the logic:
http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Access_Log_Valve
Regards,
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org