You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Aurélien Terrestris <at...@gmail.com> on 2015/10/01 16:40:05 UTC

RE: Conditional logging

A late reply to this topic...
Without the conditional test provided by the Rewrite (native Tomcat 8
Rewrite or url-rewrite), it is possible to use an Apache in front of
the Tomcat which will have two ProxyPass, and two virtual hosts on the
Tomcat itself (one servicing anything but the healtheck, the other one
for the healthcheck without logging valve). As the wildcard is not
supported by ProxyPass, we can use ProxyPassMatch for this purpose.


Apache :

ProxyPassMatch ^/(.*)/iaahb http://localhost:8081/$1/iaahb
ProxyPassMatch ^/.*$ http://localhost:8080/


Tomcat server.xml :

  <Service name="Catalina1">
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <Engine name="Catalina" defaultHost="localhost">
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
    </Engine>
  </Service>

  <Service name="Catalina2">
    <Connector port="8081" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <Engine name="Catalina" defaultHost="localhost">

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

      </Host>
    </Engine>
  </Service>



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

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


Re: Conditional logging

Posted by Aurélien Terrestris <at...@gmail.com>.
Hello,

I was just trying to answer to this question asked last year, since
some of my customers are also asking the same now and then.

I admit that sometimes there are really many health-check logs (1 or 2
monitoring tools + load-balancers checks,..). But, considering my
customers ideas, they're wrong and you're right, because logs give an
additional information about the monitoring tools if we're unsure of
the health-check itself, or about a temporary network hanging.

About the log format, I've been replacing almost everywhere the
default Valve config by one which logs the processing time, and it is
very useful for later debugging. Not that I don't like the live JMX or
JMETER scripts, but the more tools we have, the more likely we are to
explain what's happening or what happened at 5AM during the asian
market opening hours while we're sleeping deep.

A.T.





2015-10-01 20:47 GMT+02:00 Christopher Schultz <ch...@christopherschultz.net>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Aurélien,
>
> On 10/1/15 10:40 AM, Aurélien Terrestris wrote:
>> A late reply to this topic... Without the conditional test provided
>> by the Rewrite (native Tomcat 8 Rewrite or url-rewrite), it is
>> possible to use an Apache in front of the Tomcat which will have
>> two ProxyPass, and two virtual hosts on the Tomcat itself (one
>> servicing anything but the healtheck, the other one for the
>> healthcheck without logging valve). As the wildcard is not
>> supported by ProxyPass, we can use ProxyPassMatch for this
>> purpose.
>
> That seems reasonable. Are you just trying to avoid filling your logs
> with health-check requests? I would personally rather have those
> requests showing in the log; they can be filtered-out later before
> logfile analysis if you want to ignore them then.
>
> But Tomcat *is* handling the requests, so I'd want them logged.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
>
> iQIcBAEBCAAGBQJWDX+9AAoJEBzwKT+lPKRYe20QAI3sXL57X7tFoB9P+OKAgwEv
> tmj7/f89oZwY+K85eqntQWIQgxHAFOh4NjASjOBmeeXaB39+KoBLjegRlaOPssmi
> ynukIUhSnUHfgOBQj9o4MgHjYRLoE5aeZ7obkZDoEj3uQ9hdCruNNMW4X+i2Fu24
> 8GawKVlUUrgQK3U25RRtBhGFcGY6oXpgvRoiii6KKha+NPs//RPH82weG+nK4uHA
> lh9OQ3oV0AVwsyPGoewvHYX/LOoqTMMBu2t/Wpo43NEAr9giWt38vz9d62/1PvfV
> 3jDau8U1N0GS37SOj3cdLT0RcAieofNIJcwUaiZ0lsZckfPhZ3k/vW7zf0lm/oRI
> o8wzWcaXelJjMoaEbdfPZLHoKxP0cNi7S6dZv/fVe8foflsHfwc20Wo7cYBVaVuO
> a/NpwI5etQvRRHIyfLhveERi0bMV+S3g7Bfmo6PGYH3hLRQtr+s+zqbCgT9PT0oN
> NNvsI6wV92gH8FDvRQlFSFbA80uiWsUed6GtuX3TInOxrEf9JzpBESgPuaam6xu7
> 9Q5miy2ZFyOaaMmfYuXveeCzlnXZviCMisbLrZJ43oDKhC4FftmVPZhuFBDzNWZF
> Q3MeOHYgrCdyh/Ro5l/w930nuOIRQlWoVWGWqvLLyfgKPx/JXGccGV6MK6PmCl1h
> ddQCXfD0A8Q8je9o/de0
> =0nOi
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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

Aurélien,

On 10/1/15 10:40 AM, Aurélien Terrestris wrote:
> A late reply to this topic... Without the conditional test provided
> by the Rewrite (native Tomcat 8 Rewrite or url-rewrite), it is
> possible to use an Apache in front of the Tomcat which will have
> two ProxyPass, and two virtual hosts on the Tomcat itself (one
> servicing anything but the healtheck, the other one for the
> healthcheck without logging valve). As the wildcard is not 
> supported by ProxyPass, we can use ProxyPassMatch for this
> purpose.

That seems reasonable. Are you just trying to avoid filling your logs
with health-check requests? I would personally rather have those
requests showing in the log; they can be filtered-out later before
logfile analysis if you want to ignore them then.

But Tomcat *is* handling the requests, so I'd want them logged.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJWDX+9AAoJEBzwKT+lPKRYe20QAI3sXL57X7tFoB9P+OKAgwEv
tmj7/f89oZwY+K85eqntQWIQgxHAFOh4NjASjOBmeeXaB39+KoBLjegRlaOPssmi
ynukIUhSnUHfgOBQj9o4MgHjYRLoE5aeZ7obkZDoEj3uQ9hdCruNNMW4X+i2Fu24
8GawKVlUUrgQK3U25RRtBhGFcGY6oXpgvRoiii6KKha+NPs//RPH82weG+nK4uHA
lh9OQ3oV0AVwsyPGoewvHYX/LOoqTMMBu2t/Wpo43NEAr9giWt38vz9d62/1PvfV
3jDau8U1N0GS37SOj3cdLT0RcAieofNIJcwUaiZ0lsZckfPhZ3k/vW7zf0lm/oRI
o8wzWcaXelJjMoaEbdfPZLHoKxP0cNi7S6dZv/fVe8foflsHfwc20Wo7cYBVaVuO
a/NpwI5etQvRRHIyfLhveERi0bMV+S3g7Bfmo6PGYH3hLRQtr+s+zqbCgT9PT0oN
NNvsI6wV92gH8FDvRQlFSFbA80uiWsUed6GtuX3TInOxrEf9JzpBESgPuaam6xu7
9Q5miy2ZFyOaaMmfYuXveeCzlnXZviCMisbLrZJ43oDKhC4FftmVPZhuFBDzNWZF
Q3MeOHYgrCdyh/Ro5l/w930nuOIRQlWoVWGWqvLLyfgKPx/JXGccGV6MK6PmCl1h
ddQCXfD0A8Q8je9o/de0
=0nOi
-----END PGP SIGNATURE-----

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