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
c5320314
Commit
c5320314
authored
Apr 11, 2013
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
varnishevent: added config params max_vcl_log and max_vcl_call
parent
e07523f6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
16 deletions
+36
-16
config.c
bin/varnishevent/config.c
+4
-0
data.c
bin/varnishevent/data.c
+12
-9
varnishevent.c
bin/varnishevent/varnishevent.c
+17
-7
varnishevent.h
bin/varnishevent/varnishevent.h
+3
-0
No files found.
bin/varnishevent/config.c
View file @
c5320314
...
...
@@ -116,6 +116,8 @@ CONF_Add(const char *lval, const char *rval)
confUnsigned
(
"max.reclen"
,
max_reclen
);
confUnsigned
(
"max.headers"
,
max_headers
);
confUnsigned
(
"max.vcl_log"
,
max_vcl_log
);
confUnsigned
(
"max.vcl_call"
,
max_vcl_call
);
confUnsigned
(
"max.fd"
,
max_fd
);
confUnsigned
(
"max.data"
,
max_data
);
confUnsigned
(
"monitor.interval"
,
monitor_interval
);
...
...
@@ -191,6 +193,8 @@ CONF_Init(void)
config
.
max_reclen
=
DEFAULT_MAX_RECLEN
;
config
.
max_headers
=
DEFAULT_MAX_HEADERS
;
config
.
max_vcl_log
=
DEFAULT_MAX_HEADERS
;
config
.
max_vcl_call
=
DEFAULT_MAX_HEADERS
;
config
.
max_fd
=
DEFAULT_MAX_FD
;
config
.
max_data
=
DEFAULT_MAX_DATA
;
config
.
housekeep_interval
=
DEFAULT_HOUSEKEEP_INTERVAL
;
...
...
bin/varnishevent/data.c
View file @
c5320314
...
...
@@ -77,16 +77,16 @@ DATA_Clear_Logline(logline_t *ll)
ll
->
tag
[
i
].
len
=
0
;
}
#define INIT_HDR_RECORDS(tag, hdr
) do {
\
#define INIT_HDR_RECORDS(tag, hdr
, max) do {
\
if (FMT_Read_Hdr(tag)) { \
hdr = (hdr_t *) malloc(sizeof(hdr_t)); \
if (hdr == NULL) \
return errno; \
hdr->record \
= (record_t *) calloc(
config.max_headers, sizeof(record_t));
\
= (record_t *) calloc(
max, sizeof(record_t));
\
if (hdr->record == NULL) \
return errno; \
for (int j = 0; j <
config.max_headers; j++) {
\
for (int j = 0; j <
max; j++) {
\
hdr->record[j].magic = RECORD_MAGIC; \
hdr->record[j].data = &bufptr[bufidx++ * config.max_reclen]; \
} \
...
...
@@ -110,9 +110,9 @@ DATA_Init(void)
if
(
FMT_Read_Hdr
(
SLT_TxHeader
))
nrecords
+=
config
.
max_data
*
config
.
max_headers
;
if
(
FMT_Read_Hdr
(
SLT_VCL_Log
))
nrecords
+=
config
.
max_data
*
config
.
max_
headers
;
nrecords
+=
config
.
max_data
*
config
.
max_
vcl_log
;
if
(
FMT_Read_Hdr
(
SLT_VCL_call
))
nrecords
+=
config
.
max_data
*
config
.
max_
headers
;
nrecords
+=
config
.
max_data
*
config
.
max_
vcl_call
;
LOG_Log
(
LOG_DEBUG
,
"Allocating space for %d records (%d bytes)"
,
nrecords
,
nrecords
*
config
.
max_reclen
);
...
...
@@ -135,10 +135,13 @@ DATA_Init(void)
logline
[
i
].
tag
[
j
].
data
=
&
bufptr
[
bufidx
++
*
config
.
max_reclen
];
}
INIT_HDR_RECORDS
(
SLT_RxHeader
,
logline
[
i
].
rx_headers
);
INIT_HDR_RECORDS
(
SLT_TxHeader
,
logline
[
i
].
tx_headers
);
INIT_HDR_RECORDS
(
SLT_VCL_Log
,
logline
[
i
].
vcl_log
);
INIT_HDR_RECORDS
(
SLT_VCL_call
,
logline
[
i
].
vcl_call
);
INIT_HDR_RECORDS
(
SLT_RxHeader
,
logline
[
i
].
rx_headers
,
config
.
max_headers
);
INIT_HDR_RECORDS
(
SLT_TxHeader
,
logline
[
i
].
tx_headers
,
config
.
max_headers
);
INIT_HDR_RECORDS
(
SLT_VCL_Log
,
logline
[
i
].
vcl_log
,
config
.
max_vcl_log
);
INIT_HDR_RECORDS
(
SLT_VCL_call
,
logline
[
i
].
vcl_call
,
config
.
max_vcl_call
);
logline
[
i
].
magic
=
LOGLINE_MAGIC
;
DATA_Clear_Logline
(
&
logline
[
i
]);
...
...
bin/varnishevent/varnishevent.c
View file @
c5320314
...
...
@@ -264,6 +264,7 @@ collect(struct logline_t *lp, enum VSL_tag_e tag, unsigned spec,
{
hdr_t
*
hdr
=
NULL
;
record_t
*
rec
=
NULL
;
unsigned
*
max
;
switch
(
tag
)
{
case
SLT_BackendReuse
:
...
...
@@ -325,22 +326,31 @@ collect(struct logline_t *lp, enum VSL_tag_e tag, unsigned spec,
len
=
config
.
max_reclen
;
}
if
(
tag
==
SLT_RxHeader
)
if
(
tag
==
SLT_RxHeader
)
{
hdr
=
lp
->
rx_headers
;
else
if
(
tag
==
SLT_TxHeader
)
max
=
&
config
.
max_headers
;
}
else
if
(
tag
==
SLT_TxHeader
)
{
hdr
=
lp
->
tx_headers
;
else
if
(
tag
==
SLT_VCL_Log
)
max
=
&
config
.
max_headers
;
}
else
if
(
tag
==
SLT_VCL_Log
)
{
hdr
=
lp
->
vcl_log
;
else
if
(
tag
==
SLT_VCL_call
)
max
=
&
config
.
max_vcl_log
;
}
else
if
(
tag
==
SLT_VCL_call
)
{
hdr
=
lp
->
vcl_call
;
max
=
&
config
.
max_vcl_call
;
}
if
(
hdr
!=
NULL
)
{
if
(
hdr
->
nrec
<
config
.
max_headers
)
if
(
hdr
->
nrec
<
*
max
)
rec
=
&
hdr
->
record
[
hdr
->
nrec
++
];
else
{
LOG_Log
(
LOG_ALERT
,
"Number of headers exceeds max %u, DATA DISCARDED: %s [%.*s]"
,
config
.
max_headers
,
VSL_tags
[
tag
],
len
,
ptr
);
"Number of records for %s exceeds max %u, "
"DATA DISCARDED: [%.*s]"
,
VSL_tags
[
tag
],
*
max
,
len
,
ptr
);
hdr_overflows
++
;
return
;
}
...
...
bin/varnishevent/varnishevent.h
View file @
c5320314
...
...
@@ -159,6 +159,9 @@ struct config {
/* varnishd param http_max_hdr */
unsigned
max_headers
;
unsigned
max_vcl_log
;
unsigned
max_vcl_call
;
unsigned
max_fd
;
unsigned
max_data
;
...
...
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