JohanKees
JohanKees

Reputation: 699

Tomcat 7: Filter access log

I'd like to know if there is a way to filter/supress entries from getting logged in the access log in Tomcat 7. Our logfile is groing rapitly and we'd like to know if we can filter out entries so the file doesn't grow as fast as it is doing right now.

We use the Access Log Valve as described in the Tomcat configuration documentation. The entry looks like this:

<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" resolveHosts="false" />

Upvotes: 3

Views: 7722

Answers (1)

Shamit Verma
Shamit Verma

Reputation: 3827

You can use "condition" attribute to filter out requests based on request attributes.

Details : http://tomcat.apache.org/tomcat-5.5-doc/config/valve.html#Access_Log_Valve/Attributes

You can subclass "org.apache.catalina.valves.AccessLogValve" to implement more specific filter.

Upvotes: 1

Related Questions