tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Barber <>
Subject Filtering HTTP OPTIONS request method from logs?
Date Mon, 16 Sep 2013 07:42:46 GMT
Hi all.

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: - - [16/Sep/2013:17:12:49 +1000] "OPTIONS / HTTP/1.0" 200 - - - [16/Sep/2013:17:12:51 +1000] "OPTIONS / HTTP/1.0" 200 - - - [16/Sep/2013:17:12:53 +1000] "OPTIONS / HTTP/1.0" 200 - - - [16/Sep/2013:17:12:55 +1000] "OPTIONS / HTTP/1.0" 200 - - - [16/Sep/2013:17:12:57 +1000] "OPTIONS / HTTP/1.0" 200 - - - [16/Sep/2013:17:12:59 +1000] "OPTIONS / HTTP/1.0" 200 - - - [16/Sep/2013:17:13:01 +1000] "OPTIONS / HTTP/1.0" 200 - - - [16/Sep/2013:17:13:03 +1000] "OPTIONS / HTTP/1.0" 200 - - - [16/Sep/2013:17:13:05 +1000] "OPTIONS / HTTP/1.0" 200 - - - [16/Sep/2013:17:13:07 +1000] "OPTIONS / HTTP/1.0" 200 - - - [16/Sep/2013:17:13:09 +1000] "OPTIONS / HTTP/1.0" 200 - - - [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.
I've been trying to work out how to filter these out.
Basically I don't want to log anything that is using the HTTP OPTIONS Request
Method, but still want to log anything else that Tomcat usually logs.

I have a feeling it will come down to modifying the following entry in the
/etc/tomcat7/server.xml file:

<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.
The docs say that if ServletRequest.getAttribute(<VALUE>) returns null for the
attribute defined in condition, then the item will be logged.
Is there an ServletRequest attribute that is null when the http request method
is not using "OPTIONS"?

Or am I completely off track and there is a different way to filter these
access log messages?


Jim Barber

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message