tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Filtering HTTP OPTIONS request method from logs?
Date Mon, 16 Sep 2013 14:02:28 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jim,

On 9/16/13 3:42 AM, Jim Barber wrote:
> I'm hoping someone on this list can help me since I've been reading
> docs, mailing lists, FAQs, and so on for hours now, and I'm not
> having much luck finding an answer to my question.
> 
> I am using Tomcat version 7.0.42 as packaged in Debian Linux. In
> front of my Tomcat servers, I am using haproxy for load balancing. 
> The haproxy load balancers are using the HTTP OPTIONS request
> method to check if the Tomcat servers are alive and healthy.
> 
> This results in log entries like the following in the Tomcat
> accesslog file:
> 
> 10.122.32.4 - - [16/Sep/2013:17:12:49 +1000] "OPTIONS / HTTP/1.0"
> 200 - 10.122.32.4 - - [16/Sep/2013:17:12:51 +1000] "OPTIONS /
> HTTP/1.0" 200 - 10.122.32.4 - - [16/Sep/2013:17:12:53 +1000]
> "OPTIONS / HTTP/1.0" 200 - 10.122.32.4 - - [16/Sep/2013:17:12:55
> +1000] "OPTIONS / HTTP/1.0" 200 - 10.122.32.4 - -
> [16/Sep/2013:17:12:57 +1000] "OPTIONS / HTTP/1.0" 200 - 10.122.32.4
> - - [16/Sep/2013:17:12:59 +1000] "OPTIONS / HTTP/1.0" 200 - 
> 10.122.32.4 - - [16/Sep/2013:17:13:01 +1000] "OPTIONS / HTTP/1.0"
> 200 - 10.122.32.4 - - [16/Sep/2013:17:13:03 +1000] "OPTIONS /
> HTTP/1.0" 200 - 10.122.32.4 - - [16/Sep/2013:17:13:05 +1000]
> "OPTIONS / HTTP/1.0" 200 - 10.122.32.4 - - [16/Sep/2013:17:13:07
> +1000] "OPTIONS / HTTP/1.0" 200 - 10.122.32.4 - -
> [16/Sep/2013:17:13:09 +1000] "OPTIONS / HTTP/1.0" 200 - 10.122.32.4
> - - [16/Sep/2013:17:13:11 +1000] "OPTIONS / HTTP/1.0" 200 -
> 
> At the moment I'm getting one of these every 2seconds, but I
> haven't enabled the second load balancer for HA purposes yet. When
> I do that, I'll be getting twice as many hits of this type.
> 
> This is going to result in rather large log files full of noise
> that I'm not interested in.

Playing the devil's advocate here a bit...

Why wouldn't you be interested in getting these logs? They are
requests being handled by your web server. They require (a small
amount of) time and resources to process, and indicate that your lb is
still reaching-out to determine the status of the app server.

My recommendation would be to leave those logs in there (they
accurately describe a real request) and filter them out if you want to
do some kind of analytics against your log files and consider those
OPTIONS requests to be noise.

> <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" />
> 
> Specifically adding the condition="<VALUE>" attribute, but I have
> no idea what to set <VALUE> to.

It's not that simple: if you want to use "condition", then you have a
write a Valve (can't be a Filter, since it must run *before* the
AccessLogValve) that tests the request and sets a request attribute
that will then trigger this condition.

Honestly, it's not worth it IMO.

Just use logrotate + gzip and don't worry about disk space.

If you filter-out those requests, there will come a time when you'll
look back and say "wow, I wish we had all those lb requests in the log
so we could tell what's happening".

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

iQIcBAEBCAAGBQJSNw90AAoJEBzwKT+lPKRY5a0QAJBJK54sxoOAgmRwA3ZD7+O+
X1ckD5i/8oqhw3WSpK3F2+C979RZ0aWnt8/htAin9/Rq97MF0CxzDZIa/TYDKt+m
e4I4Mt/42Df604zRGM5pIXTj74wlCsaTdiDGgAalOgRZoj96w9bt+MM8hmNb91wK
/7UBHVXRaJbmlpLTPng+5d6R5f73LydPzcxbKGMExm889Qr3DVFLmQggx8+Gr6Ge
q36bCadfAXRNUQ606fj71XLwLENBQovHd25oF34l4ikwLiNrbh1RrCKYmk5n2QS2
nN6Lk98cb7hWIRae6XuMUPkVzm8W2dQS7gWUWZ2VEfLY1QKV4tYVma6PQaCP051N
tZ06wElAI/jqfRhoiYp4wJQdVw10z+BjD/3OyNpJhDydmwNAzZB80IsooLHAMFyf
3kIr/bDHL4sPcCXSxrn6XQEbb85bPYajccE2yKF7lisrNDMf049DMld+e94kaph6
tKoW+OqJDhFNYLfwlTBbJKGkh6zxkFadV621ltq++bHVSB4Xrg2Ut5w0ivv8g8CE
0lZnvZJdZigHRvhqwmbFE4xMfEdE1kQaZW2zkgDri4PXbftQV2SBZxacFE1T8SmH
02c4OMkXtzhlCBibg2SWXCrKql+nytGRpnfnmXqwaVWQfFFYIroksd15ATXKhS55
UeZ31WFFuZ+r05GAJobG
=lfwU
-----END PGP SIGNATURE-----

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


Mime
View raw message