-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Rainer,

On 7/22/14, 11:22 AM, Rainer Jung wrote:
> 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 &quot;%r&quot; %s %b &quot;%{Referer}i&quot;
>>>> &quot;%{User-Agent}i&quot;"
>>>> 
>>>> 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

+1

The
> 
original attribute ("condition") is unclear whether the logs will
be allowed or suppressed. The "conditionIf" and "conditionUnless" are
much more straightforward.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTzotkAAoJEBzwKT+lPKRYmE0P/iWZVu3vK5KZTYcpug9now09
0WHxJYBhGJAm4VbS7Mdh1yZmbBZDY1bW+91wiP9uaPy3HXRHvLnYG3ZyRi8tYhVS
8frZXdlzBJfkVS/4cFbqN5mEt98hhzOvovJxyJVZPOT9gMKcRmnWVnO0ALIJXg3d
2WHmfAMG6G9lf2diGqtHffChrYZTspdL1tVi3xMmJbDrueV9M1skWCOndCC0tTpw
xAOpCEXyMyMBgsy/N95rqiX7i+PCaBSlL/ypVcMXgiymNxoWenpc9d98JKUrcvy+
l04j7rK2r61OnfUV2BhkQtsjO2kEAYTdyKfHmkA728tpTs64pxGMK5ELjQxIdOT/
S7Iyzq3laNeRVS976GnsplacZN9WMUL5Rc/ZwUhi6Lpn+dRoYFn7VGC5Dakn1Em6
JrOQtwV3J1q7KS967/m33IIzLrGaZfDJTkMFQ6g4sdCdPLAjov/rFZOjaipOpJI2
0g/u1kXtBv/ulF91+QDCOi5ev6NLVZdj8S4DHA6ECO7uTBxI9JtcevpBNx0+AAmS
nhPlPpx97c9jb6zbX9uVEKWYiDyr+CW49pdNy1SOjoVssHg0nEvGcUJd0YnL2Q/0
18EXWnsQneDo0tUnIzIPwxM64+iBfVk668BXXsaT+8GWWJO95AGsvPn4j7/pKhaM
xwYQyLZmzXMiPRF4UD7t
=kz2Y
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to