From 9870cb23645fb1ef9861ab049a076d6559e4fc33 Mon Sep 17 00:00:00 2001
From: Rich Bowen -
, 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,
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