Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent3
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
varnishevent3
Commits
dba10578
Commit
dba10578
authored
Feb 02, 2013
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
varnishevent - added %r formatting
parent
cc3bdc14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletion
+55
-1
format.c
bin/varnishevent/format.c
+54
-0
varnishevent.h
bin/varnishevent/varnishevent.h
+1
-1
No files found.
bin/varnishevent/format.c
View file @
dba10578
...
...
@@ -252,6 +252,51 @@ FORMAT_q(backend, TxURL)
break;
#endif
#define FORMAT_r(dir, dx, hx) \
static void \
format_r_##dir(logline_t *ll, char *name, enum VSL_tag_e tag, \
char **s, size_t *len) \
{ \
(void) name; \
(void) tag; \
\
record_t *rec; \
\
rec = &TAG(ll, SLT_##dx##Request); \
if (rec->len) \
snprintf(scratch, rec->len+1, "%s", rec->data); \
else \
strcpy(scratch, "-"); \
strcat(scratch, " "); \
\
if ((rec = GET_HDR(ll, hx, "Host")) != NULL) { \
if (strncmp(rec->data, "http://", 7) != 0) \
strcat(scratch, "http://"); \
strncat(scratch, rec->data+6, rec->len-6); \
} \
else \
strcat(scratch, "http://localhost"); \
\
rec = &TAG(ll, SLT_##dx##URL); \
if (rec->len) \
strncat(scratch, rec->data, rec->len); \
else \
strcat(scratch, "-"); \
\
strcat(scratch, " "); \
rec = &TAG(ll, SLT_##dx##Protocol); \
if (rec->len) \
strncat(scratch, rec->data, rec->len); \
else \
strcat(scratch, "HTTP/1.0"); \
\
*s = scratch; \
*len = strlen(scratch); \
}
FORMAT_r
(
client
,
Rx
,
rx
)
FORMAT_r
(
backend
,
Tx
,
tx
)
FORMAT
(
client
,
s
,
TxStatus
)
FORMAT
(
backend
,
s
,
RxStatus
)
...
...
@@ -568,6 +613,15 @@ compile_fmt(char *format, compiled_fmt_t *fmt, unsigned spec, char *err)
break;
#endif
case
'r'
:
ADD_FMT
(
spec
,
fmt
,
os
,
n
,
format_r
,
NULL
,
0
);
ADD_CB_TAG
(
spec
,
fmt
->
tags
,
RxRequest
,
TxRequest
);
ADD_CB_TAG
(
spec
,
fmt
->
tags
,
RxHeader
,
TxHeader
);
ADD_CB_TAG
(
spec
,
fmt
->
tags
,
RxURL
,
TxURL
);
ADD_CB_TAG
(
spec
,
fmt
->
tags
,
RxProtocol
,
TxProtocol
);
n
++
;
break
;
case
's'
:
ADD_FMT
(
spec
,
fmt
,
os
,
n
,
format_s
,
NULL
,
0
);
ADD_CB_TAG
(
spec
,
fmt
->
tags
,
TxStatus
,
RxStatus
);
...
...
bin/varnishevent/varnishevent.h
View file @
dba10578
...
...
@@ -59,7 +59,7 @@
#endif
#define DEFAULT_CFORMAT \
"%h %l %t
%U
%s %b \"%{Referer}i\" \"%{User-agent}i\""
"%h %l %t
\"%r\"
%s %b \"%{Referer}i\" \"%{User-agent}i\""
#define ALT_CFORMAT \
"%{X-Forwarded-For}i %l %t %U %s %b \"%{Referer}i\" \"%{User-agent}i\""
...
...
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