diff options
author | Rich Bowen <rbowen@apache.org> | 2010-11-04 20:02:51 +0100 |
---|---|---|
committer | Rich Bowen <rbowen@apache.org> | 2010-11-04 20:02:51 +0100 |
commit | 9870cb23645fb1ef9861ab049a076d6559e4fc33 (patch) | |
tree | f2d97b6ece55cd1bc1e1f416fd730bb204af7c4a | |
parent | Note that the new expression language for <If> and Require expr (diff) | |
download | apache2-9870cb23645fb1ef9861ab049a076d6559e4fc33.tar.xz apache2-9870cb23645fb1ef9861ab049a076d6559e4fc33.zip |
Mention the %200{var}i syntax in the conditional logging doc.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1031155 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | docs/manual/logs.html.en | 15 | ||||
-rw-r--r-- | docs/manual/logs.xml | 16 |
2 files changed, 31 insertions, 0 deletions
diff --git a/docs/manual/logs.html.en b/docs/manual/logs.html.en index fb2a559ef0..7908cbf0d2 100644 --- a/docs/manual/logs.html.en +++ b/docs/manual/logs.html.en @@ -474,6 +474,21 @@ 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 diff --git a/docs/manual/logs.xml b/docs/manual/logs.xml index b1ec7f0d1f..a762d9d2c4 100644 --- a/docs/manual/logs.xml +++ b/docs/manual/logs.xml @@ -504,6 +504,22 @@ 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 |