Commit 1e03c7b9 authored by Walid Boudebouda's avatar Walid Boudebouda Committed by Dridi Boukelmoune

varnishncsa: Add %{Varnish:default_format}x

This is an extended variable that has the same format as the default one
used when no format is specified.  The variable is useful for appending
or prepending other formatters to the default format.
parent f3575e38
......@@ -162,6 +162,8 @@ static struct ctx {
int64_t vxid;
} CTX;
static void parse_format(const char *format);
static void
openout(int append)
{
......@@ -681,6 +683,10 @@ parse_x_format(char *buf)
addf_vsl((enum VSL_tag_e)slt, lval, r);
return;
}
if (!strcmp(buf, "Varnish:default_format")) {
parse_format(FORMAT);
return;
}
VUT_Error(vut, 1, "Unknown formatting extension: %s", buf);
}
......
......@@ -182,4 +182,14 @@ shell -expect ${localhost} {
varnishncsa -n ${v1_name} -d -q 'RespStatus == 400'
}
shell {
(
varnishncsa -n ${v1_name} -d -k 1
varnishncsa -n ${v1_name} -d -k 1 -F "%{User-Agent}i"
) >def_then_ua.txt
varnishncsa -n ${v1_name} -d -k 1 >def_with_ua.txt \
-F "%{Varnish:default_format}x\n%{User-Agent}i"
diff -u def_then_ua.txt def_with_ua.txt
}
# ESI coverage in e00003.vtc
......@@ -173,6 +173,10 @@ Supported formatters are:
%{X}x
Extended variables. Supported variables are:
Varnish:default_format
The log format used when neither -f nor -F options are specified.
Useful for appending/prepending with other formatters.
Varnish:time_firstbyte
Time from when the request processing starts until the first
byte is sent to the client, in seconds. For backend mode: Time
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment