-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Kris,
On 7/21/2014 3: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>
>
>
> -- Kris Dames
>
>
> This electronic mail and any attached documents are intended solely
> for the named addressee(s) and contain confidential information. If
> you are not an addressee, or responsible for delivering this email
> to an addressee, you have received this email in error and are
> notified that reading, copying, or disclosing this email is
> prohibited. If you received this email in error, immediately reply
> to the sender and delete the message completely from your computer
> system.
>
I have not explored this, so these comments are based on the
documentation.
http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Access_Log_Valve
Turns on conditional logging. If set, requests will be logged only
if ServletRequest.getAttribute() is null. For example, if this
value is set to junk, then a particular request will only be
logged if ServletRequest.getAttribute("junk") == null. The use of
Filters is an easy way to set/unset the attribute in the
ServletRequest on many different requests.
So . . .
1. multiple URL patterns to add an attribute - exclude /*/iaahb
2. rewrite the filter to:
a. examine the URI
b. add the attribute if it does not include /*/iaahb
c. set the URL pattern to /*
3. Use tuckey.org's URL rewrite filter (http://tuckey.org/urlrewrite/)
a. use a negative regular expression match
b. set the attribute value for all URI patterns except /*/iaahb
. . . just my two cents
/mde/
. . . just my two cents
/mde/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJTzaJiAAoJEEFGbsYNeTwtIpcH+wbCNN5C4GPSPkMvmdVX79/M
2j8gOOtf/dhC8uAqjjAfzLdMmN6XVnXQXKL//KH1MT94cOTo3pl5KzMwu4mx5YBq
TjH2mHueyfHigxOpBUOJncR4HDrP+TI9ssBIgY9lFLkSWOpYWSVPtbIMRHRGSdwv
zB7ZpZD9J8IpuEOi/tj3yoYl5HkCofIhL2iBHunhoaCDGncrfg1io6EDKKJyxZ9z
XDjRsAbWK7Rczior7skD9A9sjm7Pg9n/npbyx5G6DU8v1G+uQxLSTDpN53o8lbVV
e7b7vRJoRMHD2JI4uyznLMp6WeKXLCcrSIGYKaoujSd/A79koz7HxvRusY4RrOo=
=r7yf
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]