diff --git a/include/fluent-bit/flb_aws_util.h b/include/fluent-bit/flb_aws_util.h index 339735ca1fc..ee0736b6fda 100644 --- a/include/fluent-bit/flb_aws_util.h +++ b/include/fluent-bit/flb_aws_util.h @@ -102,6 +102,9 @@ struct flb_aws_client { /* Send all log messages as debug; used in AWS Cred Providers on init */ int debug_only; + + /* Callbacks context */ + struct flb_callback *http_cb_ctx; }; /* frees dynamic_headers */ diff --git a/plugins/out_kinesis_firehose/firehose.c b/plugins/out_kinesis_firehose/firehose.c index a10d60e24dd..a9336c8146e 100644 --- a/plugins/out_kinesis_firehose/firehose.c +++ b/plugins/out_kinesis_firehose/firehose.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -288,6 +289,10 @@ static int cb_firehose_init(struct flb_output_instance *ins, ctx->firehose_client->proxy = NULL; ctx->firehose_client->static_headers = &content_type_header; ctx->firehose_client->static_headers_len = 1; + if (flb_http_client_debug_setup(ctx->firehose_client->http_cb_ctx, &ins->properties) < 0) { + flb_plg_error(ctx->ins, "AWS HTTP client debug initialization error"); + goto error; + } struct flb_upstream *upstream = flb_upstream_create(config, ctx->endpoint, ctx->port, FLB_IO_TLS, diff --git a/src/aws/flb_aws_util.c b/src/aws/flb_aws_util.c index 6ba8b28cf2d..4c40456f315 100644 --- a/src/aws/flb_aws_util.c +++ b/src/aws/flb_aws_util.c @@ -268,6 +268,12 @@ struct flb_aws_client *flb_aws_client_create() client->client_vtable = &client_vtable; client->retry_requests = FLB_FALSE; client->debug_only = FLB_FALSE; + client->http_cb_ctx = flb_callback_create("aws client"); + if (!client->http_cb_ctx) { + flb_errno(); + flb_free(client); + return NULL; + } return client; } @@ -291,6 +297,7 @@ void flb_aws_client_destroy(struct flb_aws_client *aws_client) if (aws_client->extra_user_agent) { flb_sds_destroy(aws_client->extra_user_agent); } + flb_callback_destroy(aws_client->http_cb_ctx); flb_free(aws_client); } } @@ -386,6 +393,8 @@ struct flb_http_client *request_do(struct flb_aws_client *aws_client, goto error; } + c->cb_ctx = aws_client->http_cb_ctx; + /* Increase the maximum HTTP response buffer size to fit large responses from AWS services */ ret = flb_http_buffer_size(c, FLB_MAX_AWS_RESP_BUFFER_SIZE); if (ret != 0) {