Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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" />
like image 939
JohanKees Avatar asked Mar 28 '26 15:03

JohanKees


1 Answers

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.

like image 181
Shamit Verma Avatar answered Mar 31 '26 04:03

Shamit Verma