From 9870cb23645fb1ef9861ab049a076d6559e4fc33 Mon Sep 17 00:00:00 2001 From: Rich Bowen Date: Thu, 4 Nov 2010 19:02:51 +0000 Subject: 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 --- docs/manual/logs.html.en | 15 +++++++++++++++ docs/manual/logs.xml | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) 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 -, while a cache miss will log 1.

+

In addition to the env= syntax, LogFormat supports logging values + conditional upon the HTTP response code:

+ +

+ LogFormat "%400,501{User-agent}i" browserlog
+ LogFormat "%!200,304,302{Referer}i" refererlog +

+ +

In the first example, the User-agent 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 Referer will be logged if the HTTP + status code is not 200, 204, or 302. (Note the + "!" before the status codes.

+

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 -, while a cache miss will log 1.

+

In addition to the env= syntax, LogFormat supports logging values + conditional upon the HTTP response code:

+ + + LogFormat "%400,501{User-agent}i" browserlog
+ LogFormat "%!200,304,302{Referer}i" refererlog +
+ +

In the first example, the User-agent 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 Referer will be logged if the HTTP + status code is not 200, 204, or 302. (Note the + "!" before the status codes.

+

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 -- cgit v1.2.3