Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
56d17a6d
Commit
56d17a6d
authored
Oct 31, 2011
by
Lasse Karstensen
Committed by
Tollef Fog Heen
Oct 31, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new format %{VCL_Log:foo}x which output key:value from std.log() in VCL
parent
cf66e086
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
varnishncsa.c
bin/varnishncsa/varnishncsa.c
+47
-0
varnishncsa.rst
doc/sphinx/reference/varnishncsa.rst
+4
-0
No files found.
bin/varnishncsa/varnishncsa.c
View file @
56d17a6d
...
@@ -108,6 +108,7 @@ static struct logline {
...
@@ -108,6 +108,7 @@ static struct logline {
uint64_t
bitmap
;
/* Bitmap for regex matches */
uint64_t
bitmap
;
/* Bitmap for regex matches */
VTAILQ_HEAD
(,
hdr
)
req_headers
;
/* Request headers */
VTAILQ_HEAD
(,
hdr
)
req_headers
;
/* Request headers */
VTAILQ_HEAD
(,
hdr
)
resp_headers
;
/* Response headers */
VTAILQ_HEAD
(,
hdr
)
resp_headers
;
/* Response headers */
VTAILQ_HEAD
(,
hdr
)
vcl_log
;
/* VLC_Log entries */
}
**
ll
;
}
**
ll
;
struct
VSM_data
*
vd
;
struct
VSM_data
*
vd
;
...
@@ -219,6 +220,19 @@ resp_header(struct logline *l, const char *name)
...
@@ -219,6 +220,19 @@ resp_header(struct logline *l, const char *name)
return
NULL
;
return
NULL
;
}
}
static
char
*
vcl_log
(
struct
logline
*
l
,
const
char
*
name
)
{
struct
hdr
*
h
;
VTAILQ_FOREACH
(
h
,
&
l
->
vcl_log
,
list
)
{
if
(
strcasecmp
(
h
->
key
,
name
)
==
0
)
{
return
h
->
value
;
break
;
}
}
return
NULL
;
}
static
void
static
void
clean_logline
(
struct
logline
*
lp
)
clean_logline
(
struct
logline
*
lp
)
{
{
...
@@ -245,6 +259,12 @@ clean_logline(struct logline *lp)
...
@@ -245,6 +259,12 @@ clean_logline(struct logline *lp)
freez
(
h
->
value
);
freez
(
h
->
value
);
freez
(
h
);
freez
(
h
);
}
}
VTAILQ_FOREACH_SAFE
(
h
,
&
lp
->
vcl_log
,
list
,
h2
)
{
VTAILQ_REMOVE
(
&
lp
->
vcl_log
,
h
,
list
);
freez
(
h
->
key
);
freez
(
h
->
value
);
freez
(
h
);
}
#undef freez
#undef freez
memset
(
lp
,
0
,
sizeof
*
lp
);
memset
(
lp
,
0
,
sizeof
*
lp
);
}
}
...
@@ -465,6 +485,25 @@ collect_client(struct logline *lp, enum VSL_tag_e tag, unsigned spec,
...
@@ -465,6 +485,25 @@ collect_client(struct logline *lp, enum VSL_tag_e tag, unsigned spec,
}
}
break
;
break
;
case
SLT_VCL_Log
:
if
(
!
lp
->
active
)
break
;
split
=
strchr
(
ptr
,
':'
);
if
(
split
==
NULL
)
break
;
struct
hdr
*
h
;
h
=
malloc
(
sizeof
(
struct
hdr
));
AN
(
h
);
AN
(
split
);
h
->
key
=
trimline
(
ptr
,
split
);
h
->
value
=
trimline
(
split
+
1
,
end
);
VTAILQ_INSERT_HEAD
(
&
lp
->
vcl_log
,
h
,
list
);
break
;
case
SLT_VCL_call
:
case
SLT_VCL_call
:
if
(
!
lp
->
active
)
if
(
!
lp
->
active
)
break
;
break
;
...
@@ -718,6 +757,14 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
...
@@ -718,6 +757,14 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
VSB_cat
(
os
,
(
lp
->
df_handling
?
lp
->
df_handling
:
"-"
));
VSB_cat
(
os
,
(
lp
->
df_handling
?
lp
->
df_handling
:
"-"
));
p
=
tmp
;
p
=
tmp
;
break
;
break
;
}
else
if
(
strncmp
(
fname
,
"VCL_Log:"
,
8
)
==
0
)
{
// support pulling entries logged with std.log() into output.
// Format: %{VCL_Log:keyname}x
// Logging: std.log("keyname:value")
h
=
vcl_log
(
lp
,
fname
+
8
);
VSB_cat
(
os
,
h
?
h
:
"-"
);
p
=
tmp
;
break
;
}
}
default:
default:
fprintf
(
stderr
,
"Unknown format starting at: %s
\n
"
,
--
p
);
fprintf
(
stderr
,
"Unknown format starting at: %s
\n
"
,
--
p
);
...
...
doc/sphinx/reference/varnishncsa.rst
View file @
56d17a6d
...
@@ -117,6 +117,10 @@ The following options are available:
...
@@ -117,6 +117,10 @@ The following options are available:
How the request was handled, whether it was a
How the request was handled, whether it was a
cache hit, miss, pass, pipe or error.
cache hit, miss, pass, pipe or error.
VCL_Log:key
Output value set by std.log("key=value") in VCL.
-m tag:regex only list records where tag matches regex. Multiple
-m tag:regex only list records where tag matches regex. Multiple
-m options are AND-ed together.
-m options are AND-ed together.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment