Skip to content

Commit

Permalink
in_splunk: Provide keepalive option to be able to switch on/off
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Jun 28, 2024
1 parent 13f96f9 commit 4ea0cec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 13 additions & 2 deletions plugins/in_splunk/splunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ static int in_splunk_init(struct flb_input_instance *ins,
unsigned short int port;
int ret;
struct flb_splunk *ctx;
int http2_flags = 0;

(void) data;

Expand All @@ -95,9 +96,13 @@ static int in_splunk_init(struct flb_input_instance *ins,


if (ctx->enable_http2) {
ret = flb_http_server_init(&ctx->http_server,
http2_flags = FLB_HTTP_SERVER_FLAG_AUTO_INFLATE;
if (ctx->auto_keepalive) {
http2_flags |= FLB_HTTP_SERVER_FLAG_KEEPALIVE;
}
ret = flb_http_server_init(&ctx->http_server,
HTTP_PROTOCOL_AUTODETECT,
(FLB_HTTP_SERVER_FLAG_KEEPALIVE | FLB_HTTP_SERVER_FLAG_AUTO_INFLATE),
http2_flags,
NULL,
ins->host.listen,
ins->host.port,
Expand Down Expand Up @@ -212,6 +217,12 @@ static struct flb_config_map config_map[] = {
NULL
},

{
FLB_CONFIG_MAP_BOOL, "keepalive", "Off",
0, FLB_TRUE, offsetof(struct flb_splunk, auto_keepalive),
"Enable keepalive automatically when enabled HTTP2"
},

{
FLB_CONFIG_MAP_SIZE, "buffer_max_size", HTTP_BUFFER_MAX_SIZE,
0, FLB_TRUE, offsetof(struct flb_splunk, buffer_max_size),
Expand Down
3 changes: 3 additions & 0 deletions plugins/in_splunk/splunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ struct flb_splunk {
int enable_http2;
struct flb_http_server http_server;

/* Auto Keepalive? */
int auto_keepalive;

/* Legacy HTTP server */
flb_sds_t success_headers_str;
int collector_id;
Expand Down

0 comments on commit 4ea0cec

Please sign in to comment.