]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Mention the %200{var}i syntax in the conditional logging doc.
authorRich Bowen <rbowen@apache.org>
Thu, 4 Nov 2010 19:02:51 +0000 (19:02 +0000)
committerRich Bowen <rbowen@apache.org>
Thu, 4 Nov 2010 19:02:51 +0000 (19:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1031155 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/logs.html.en
docs/manual/logs.xml

index fb2a559ef0073f8ce989d541b777d1f4f7f880f5..7908cbf0d24649460c8a0cb92ffd8527591480ba 100644 (file)
       content without it. In that case a cache hit will log
       <code>-</code>, while a cache miss will log <code>1</code>.</p>
 
+      <p>In addition to the <code>env=</code> syntax, <code class="directive"><a href="./mod/mod_log_config.html#logformat">LogFormat</a></code> supports logging values
+      conditional upon the HTTP response code:</p>
+
+      <div class="example"><p><code>
+      LogFormat "%400,501{User-agent}i" browserlog<br />
+      LogFormat "%!200,304,302{Referer}i" refererlog
+      </code></p></div>
+
+      <p>In the first example, the <code>User-agent</code> will be
+      logged if the HTTP status code is 400 or 501. In other cases, a
+      literal "-" will be logged instead. Likewise, in the second
+      example, the <code>Referer</code> will be logged if the HTTP
+      status code is <strong>not</strong> 200, 204, or 302. (Note the
+      "!" before the status codes.</p>
+
       <p>Although we have just shown that conditional logging is very
       powerful and flexible, it is not the only way to control the
       contents of the logs. Log files are more useful when they
index b1ec7f0d1f6902243746a8719d53c7e36b0c8d8f..a762d9d2c464759b54c345a2faf4c470563e0f68 100644 (file)
       content without it. In that case a cache hit will log
       <code>-</code>, while a cache miss will log <code>1</code>.</p>
 
+      <p>In addition to the <code>env=</code> syntax, <directive
+      module="mod_log_config">LogFormat</directive> supports logging values
+      conditional upon the HTTP response code:</p>
+
+      <example>
+      LogFormat "%400,501{User-agent}i" browserlog<br />
+      LogFormat "%!200,304,302{Referer}i" refererlog
+      </example>
+
+      <p>In the first example, the <code>User-agent</code> will be
+      logged if the HTTP status code is 400 or 501. In other cases, a
+      literal "-" will be logged instead. Likewise, in the second
+      example, the <code>Referer</code> will be logged if the HTTP
+      status code is <strong>not</strong> 200, 204, or 302. (Note the
+      "!" before the status codes.</p>
+
       <p>Although we have just shown that conditional logging is very
       powerful and flexible, it is not the only way to control the
       contents of the logs. Log files are more useful when they