diff --git a/plugins/in_splunk/splunk.c b/plugins/in_splunk/splunk.c index b10dfa8f00e..97065c8844a 100644 --- a/plugins/in_splunk/splunk.c +++ b/plugins/in_splunk/splunk.c @@ -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; @@ -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, @@ -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), diff --git a/plugins/in_splunk/splunk.h b/plugins/in_splunk/splunk.h index e72905b5a80..4d1462455b7 100644 --- a/plugins/in_splunk/splunk.h +++ b/plugins/in_splunk/splunk.h @@ -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;