title: Apache2 Logging Conditional with multiple env set
body: <p>So we have X-Forwarded-For enabled on our SLBs which is working, and I've got correct logging working via the <a href="http://www.techstacks.com/howto/log-client-ip-and-xforwardedfor-ip-in-apache.html" rel="nofollow noreferrer">link here</a>, which says to use this SetEnvIF statement.</p>
  <p>The problem we are running into is, the SLBs also check ever 5seconds via a GET /health.html file, which is filling up our logs. I was able to find a way to get apache2 to stop logging specific files, however I cannot seem to find a way to do both X-Forward-For and Don't Log specific files.</p>
  <p>This was my last attempt, when I read a blog saying you could use multiple Env and sepearate them by a ',' which didn't owrk :(.</p>
  <pre><code>    #logs
      LogFormat &quot;%h %l %u %t \&quot;%r\&quot; %&gt;s %b \&quot;%{Referer}i\&quot; \&quot;%{User-Agent}i\&quot;&quot; combined
      LogFormat &quot;%{X-Forwarded-For}i %l %u %t \&quot;%r\&quot; %&gt;s %b \&quot;%{Referer}i\&quot; \&quot;%{User-Agent}i\&quot;&quot; proxy
      SetEnvIf X-Forwarded-For &quot;^.*\..*\..*\..*&quot; forwarded
      SetEnvIf Request_URI &quot;^/health\.html$&quot; dontlog
  
      CustomLog &quot;/www/logs/access.log&quot;  combined env=!forwarded,!dontlog
      CustomLog &quot;/www/logs/access.log&quot;  proxy env=forwarded
  </code></pre>
  <p>I appreciate everyones help.</p>
  <p>Thank you for your time.</p>