You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Dames, Kristopher J" <Kr...@Mercy.Net> on 2014/07/22 00:43:52 UTC

Conditional logging

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>


--
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.

Re: Conditional logging

Posted by Mark Eggers <it...@yahoo.com.INVALID>.
-----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 &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>
> 
> 
> -- 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Conditional logging

Posted by Konstantin Kolinko <kn...@gmail.com>.
2014-07-22 2:43 GMT+04:00 Dames, Kristopher J <Kr...@mercy.net>:
> 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>

The url-pattern syntax defined by the Servlet specification is
somewhat limited. The "*" has special meaning in two constructs only:
a) when defining prefix mapping, as "/*" at the end, e.g. /foo/*
b) when defining extension mapping, .e.g. *.foo

In all other situations the "*" character is interpreted literally as
a character, with no special meaning.

>     </filter-mapping>

Best regards,
Konstantin Kolinko

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


Re: Conditional logging

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Keith,

On 7/22/14, 10:13 AM, Pendergrass, Keith D CIV SPAWARSYSCEN-ATLANTIC,
54350 wrote:
> Chris,
> 
> Quick question, I upgraded to 7.0.54 with new user/pass. My issue
> is that these credentials will not log me in to ANY management
> function going through the GUI??? If I append the WEBAPP Tho the
> url http://localhost\web app name this launches the app - but still
> I need to access all CmcApps via the GUI. Any ideas?

Please don't hijack threads. If you have a question, please create a
new email message to users@tomcat.apache.org, give it a new subject,
and don't address it to a single person (like me). This is a community
and not a one-on-one help desk.

Thanks,
- -chris

> -----Original Message----- From: Christopher Schultz
> [mailto:chris@christopherschultz.net] Sent: Tuesday, July 22, 2014
> 9:09 AM To: Tomcat Users List Subject: Re: Conditional logging
> 
> 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?
> 
> -chris
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTzosRAAoJEBzwKT+lPKRYFqsP/3iU9G9ILLqxHD3ZEnmc+2xl
VCgQFM3ljw4E9eXjzPsJWN06uD8NT42eRhsT4GhwQAadmmv1uartLZx0V0r47u2A
YNyBuAXgHjvKby5L+aF3DPoTzH/M+WnUpfpfdJeq0rFYGslDW4vqRjGOyi/Y7wrC
QxDedf3zcDHZUQTqxVQQOH2aklI7mhryy508jj4T7f2tiZEtg0T7Rcu2q+FW3+84
ZvgQc9P0dqvBsq/7iQUcjpNeXuCxu1twQduJL5GiAE1xtD/1+B4lugCtOyD9OPjY
dvSvub/30cLfdOwm6K/tO544I3TTFHkN71TVszZaMLvx6ZvLPlt4FdsE6KLTRVD3
7JJDxglvzFoNo0tjTGoZreg+ZbY1aiEiJy/7/Xbhm/1hvOtftTioR3omxcMrKjbG
GCuDx9TYhQgzZfCRdd6d9IxQZd4QUvmMI04BINvGtPGxGoi5S4Jpdhm4dz3mzix3
vmdnrfAGE5j6LljZUUvm89XqCWvcf20i0g5zXnegHI50P6PYl83n33pwoz8U0fOR
UJspV2P32LPZYM0DTmVN7UUTuGggWouI8FI6MaSbx7Eqe+MrfbND1Qwn7tZd0V0y
oSjmNYMckaQppNhiH3rsVWL/ZCJ2AMsim2C7i+lJH2qOpHdnr8MO4iQrStN70v43
BN6Gsiq+reDhj2otqU/s
=Dp2M
-----END PGP SIGNATURE-----

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


RE: Conditional logging

Posted by "Pendergrass, Keith D CIV SPAWARSYSCEN-ATLANTIC, 54350" <Ke...@navy.mil>.
Chris,

Quick question, I upgraded to 7.0.54 with new user/pass. My issue is that these credentials will not log me in to ANY management function going through the GUI??? If I append the WEBAPP 
Tho the url http://localhost\web app name this launches the app - but still I need to access all CmcApps via the GUI. Any ideas?

Thanks,

Keith Pendergrass (CIV) MS/ MBA/ Network+
IT Specialist (APPSW) Software/Data Engineer
Space & Naval Warfare Systems Command-Atlantic
2251 Lakeshore Drive
New Orleans, La 70122
Work: (504) 697-5549
DSN: 647-5549
Fax:  (504) 697-5628
Keith.pendergrass@navy.mil


-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Tuesday, July 22, 2014 9:09 AM
To: Tomcat Users List
Subject: Re: Conditional logging

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

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?

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

iQIcBAEBCAAGBQJTznCUAAoJEBzwKT+lPKRYlKQQAKFrkhuDlohUc71mm0iBQXRl
jOcU4LD1Coq2m+dtQscGdgbwJ7vvr3wCGLFjJ+k6SPGkDDon1N0xQ/RsXApFFvme
KqR3B851de9TtZlAiCgRJsWnvoXNMsSp8aeQxcwV1hSj/s9agDd8hHQj9ffw+Hnu
E9wcw4uFlM0+cDvqc6lMlP2P1lgj9F0UWmzcQFw1p3iUxUiiOsXXXBls5KlLtT7D
Si/69y/Ul0FOy9kvNl/W1EPVZcKEE6c3r4/UAYaLoZmxtKFIa6FkKVJGW3oK16PH
F2mTPnYLwNN3fSEwaJEMlmAUg58UfSkTdMtIaARbMD0SC34zeHqipVOMJ5mwtSuJ
XYAgD1euYzGmwewQL1Xi/pqdWngplFuJNnBeMgxUaQdw3p6WwWgdl2CN/FPfYkjo
R/VW01flR+UlkavQjcKi/uv9fDy0Y2Hn+q1wFtOVqwxcDIa8bdKm00KllYNRClhz
Ddu+xMg55LkZi/qeMUan8YNidNH1RiXa74A5i4BR7VLf5jtO+j0FHxx9H1WDbkNp
O887mfSrU75zgr1ACg8yoPpw5lVfqBYfhkfa2Clf6eNQWgBs3Ki6KZzH/f1dEM4S
YVo7T+1yESMvLTb2fK5J5wJv/WIuZWUfNY6n7r9vOjxj61lo7q6UjutYeNO746N1
hSIMjlfwoc0IeqGMB0M3
=k8cT
-----END PGP SIGNATURE-----

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


Re: Conditional logging

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Conditional logging

Posted by Rainer Jung <ra...@kippdata.de>.
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

Regards,

Rainer


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


RE: Conditional logging

Posted by "Dames, Kristopher J" <Kr...@Mercy.Net>.

> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: Tuesday, July 22, 2014 11:06 AM
> To: Tomcat Users List
> Subject: Re: Conditional logging
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Kris,
> 
> On 7/22/14, 10:22 AM, 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?
> >>
> >> - -chris
> >
> >
> > Perhaps that's my problem, I do not have any code to support this.
> > I think for this to work as I have it now I need an existing Java
> > filter class.
> 
> Hah. Okay, so then what does "SetDoNotLogFilter" refer to? Or were you
> just hoping that would magically work?



Yes, I was hoping for a little magic. Conditional logging seems like such a basic concept that I am greatly surprised to have to jump through hoops to achieve it. The documentation I've read for filters seems to be intended for an audience with prior webapp development experience. Unfortunately I do not fall into that crowd, so I was unaware a filter had to be related to another piece of configuration/code. I am looking into the url-rewrite filter as suggested. Thanks!

--
Kris Dames



> 
> Mark's response was prescient: you probably want to use the
> url-rewrite filter because it will avoid you having to write any new
> code.
> 
> - -chris


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.

Re: Conditional logging

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Kris,

On 7/22/14, 10:22 AM, 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?
>> 
>> - -chris
> 
> 
> Perhaps that's my problem, I do not have any code to support this.
> I think for this to work as I have it now I need an existing Java
> filter class.

Hah. Okay, so then what does "SetDoNotLogFilter" refer to? Or were you
just hoping that would magically work?

Mark's response was prescient: you probably want to use the
url-rewrite filter because it will avoid you having to write any new code.

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

iQIcBAEBCAAGBQJTzovQAAoJEBzwKT+lPKRYDRoQAIx5M5j+2Y5faPWuAFr4lZzG
vq7f0quAfppVx6KZfpKalgDQ3um/leEp5LK2El7X5VB9BDEVYN3Na1q2Jv2/fkdi
Sw5/KdvHBOi21FlTxR4Bnt/M3V37OcJZBXapdg6s/eEUnGiddQ52WqLuz5s1BzT0
5LjS3yRNE9cNStEzrLmkPuzaMjskg0crN8te+s3DvNbtU8cmXcUMZK9WZf9+ALnH
/lCF4fEvt69FyqIE76kBNOvt8piDUsfv6HnXM5Jpq5ImxKNaKbpAPnQrzQYLG1hN
JEr1xquzCeqGhcZNoAyo/kPsZ7dJRaL5C0r7NFy/tCM1gyekzKtHZmZQC4s4MWn/
X8NvRdDin/GgktwUKMTBv6kzu8YrZVwGsQMCkrJNNiLzL1XnHIPB0uP9y135C/8/
p6n/Q7ZaZHtWTKRrRFzQdKR4Rj1bQ3OddDIeFERjVIQo4DBFiTyo4REoPwDyVyNZ
5EFOYi8spH3pTNDOoLHuS2snM0XsN6mBhB179m2g6mq8fXjKTUi4ZWS3etn+CX9J
FnjZvmBw/OAzrlcqogoLeDTYaNQ7RfwsoIwcq6kdygbUBlEdt+kuiuwh34yX9MOs
TMFDYFf9jUZBZXHIBy/cdILBPqKfi6h6rTM4iqoTb/HffjBLXZnTcPW/xBg5Vf9z
vw+Q1daGvIbfa4ZRATC6
=FMhI
-----END PGP SIGNATURE-----

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


RE: Conditional logging

Posted by "Dames, Kristopher J" <Kr...@Mercy.Net>.
> 
> 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?
> 
> - -chris


Perhaps that's my problem, I do not have any code to support this. I think for this to work as I have it now I need an existing Java filter class.

--
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.

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


Re: Conditional logging

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

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?

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

iQIcBAEBCAAGBQJTznCUAAoJEBzwKT+lPKRYlKQQAKFrkhuDlohUc71mm0iBQXRl
jOcU4LD1Coq2m+dtQscGdgbwJ7vvr3wCGLFjJ+k6SPGkDDon1N0xQ/RsXApFFvme
KqR3B851de9TtZlAiCgRJsWnvoXNMsSp8aeQxcwV1hSj/s9agDd8hHQj9ffw+Hnu
E9wcw4uFlM0+cDvqc6lMlP2P1lgj9F0UWmzcQFw1p3iUxUiiOsXXXBls5KlLtT7D
Si/69y/Ul0FOy9kvNl/W1EPVZcKEE6c3r4/UAYaLoZmxtKFIa6FkKVJGW3oK16PH
F2mTPnYLwNN3fSEwaJEMlmAUg58UfSkTdMtIaARbMD0SC34zeHqipVOMJ5mwtSuJ
XYAgD1euYzGmwewQL1Xi/pqdWngplFuJNnBeMgxUaQdw3p6WwWgdl2CN/FPfYkjo
R/VW01flR+UlkavQjcKi/uv9fDy0Y2Hn+q1wFtOVqwxcDIa8bdKm00KllYNRClhz
Ddu+xMg55LkZi/qeMUan8YNidNH1RiXa74A5i4BR7VLf5jtO+j0FHxx9H1WDbkNp
O887mfSrU75zgr1ACg8yoPpw5lVfqBYfhkfa2Clf6eNQWgBs3Ki6KZzH/f1dEM4S
YVo7T+1yESMvLTb2fK5J5wJv/WIuZWUfNY6n7r9vOjxj61lo7q6UjutYeNO746N1
hSIMjlfwoc0IeqGMB0M3
=k8cT
-----END PGP SIGNATURE-----

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