title: Conditionally filter Tomcat AccessLogValve
body: <p>I try to make Tomcat conditionally skip logging, so the access log isn't filled with lots of local application to application communication entries.</p>
  
  <p>At the moment I have the following in server.xml:</p>
  
  <pre><code>&lt;Valve className="org.apache.catalina.valves.RemoteIpValve" /&gt;
  &lt;Valve className="org.apache.catalina.valves.AccessLogValve" directory="/var/log/alfresco"
  prefix="tomcat.access." suffix=".log" conditionUnless="???" pattern="combined" /&gt;
  </code></pre>
  
  <p>As you can see, I use the RemoteIpValve to show me the X-Forwarded-For values, instead of local IP's.
  But to filter the actual logging, I can see I can use 'conditionUnless' in Tomcat >7.0.30 (which I use). But After lots of searches, I can't find any working example and/or more detailed instructions than those in the Tomcat documentation about this Valve (<a href="https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Access_Log_Valve" rel="nofollow">https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Access_Log_Valve</a>).</p>
  
  <p>Can someone help me with an example and/or pointers on how to exclude the following:</p>
  
  <ol>
  <li>everything coming from IP "127.0.0.1" and/or</li>
  <li>all traffic to the application / relative URL: "/abc/.*"</li>
  </ol>
  
  <p>Desparately, I already filled in "/abc/.*" as the value for conditionUnless (in the place of the questionmarks), but that didn't do anything.</p>