Skip to content

Commit

Permalink
added default kusto ingest endpoint configs
Browse files Browse the repository at this point in the history
Signed-off-by: Tanmaya Panda <[email protected]>
  • Loading branch information
tanmaya-panda1 committed Jan 8, 2024
1 parent cd497e3 commit 80a424d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
21 changes: 21 additions & 0 deletions plugins/out_azure_kusto/azure_kusto.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,17 @@ flb_sds_t execute_ingest_csl_command(struct flb_azure_kusto *ctx, const char *cs
struct flb_http_client *c;
flb_sds_t resp = NULL;

ctx->u->base.net.connect_timeout = ctx->ingestion_endpoint_connect_timeout;
ctx->u->base.net.keepalive_max_recycle = ctx->keep_alive_max_connection_recycle;

/* Get upstream connection */
u_conn = flb_upstream_conn_get(ctx->u);

if (!u_conn) {
flb_plg_error(ctx->ins, "[out_azure_kusto] cannot create upstream connection while connecting to kusto endpoint");
FLB_OUTPUT_RETURN(FLB_RETRY);
}

if (u_conn) {
token = get_azure_kusto_token(ctx);

Expand Down Expand Up @@ -219,6 +227,13 @@ static int cb_azure_kusto_init(struct flb_output_instance *ins, struct flb_confi
return -1;
}

const char *tmp = flb_output_get_property("ingestion_endpoint_connect_timeout", ins);
if (tmp != NULL) {
ctx->ingestion_endpoint_connect_timeout = strtol(tmp, NULL, 0);
} else {
ctx->ingestion_endpoint_connect_timeout = FLB_AZURE_KUSTO_INGEST_ENDPOINT_CONNECTION_TIMEOUT;
}

flb_output_set_context(ins, ctx);

/* Network mode IPv6 */
Expand Down Expand Up @@ -462,6 +477,12 @@ static struct flb_config_map config_map[] = {
offsetof(struct flb_azure_kusto, time_key),
"The key name of the time. If 'include_time_key' is false, "
"This property is ignored"},
{FLB_CONFIG_MAP_TIME, "ingestion_endpoint_connect_timeout", FLB_AZURE_KUSTO_INGEST_ENDPOINT_CONNECTION_TIMEOUT, 0, FLB_TRUE,
offsetof(struct flb_azure_kusto, ingestion_endpoint_connect_timeout),
"Set the ingestion endpoint connection timeout in seconds"},
{FLB_CONFIG_MAP_INT, "keep_alive_max_connection_recycle", FLB_AZURE_KUSTO_KEEP_ALIVE_MAX_RECYCLE, 0, FLB_TRUE,
offsetof(struct flb_azure_kusto, keep_alive_max_connection_recycle),
"Set the ingestion endpoint connection timeout in seconds"},
/* EOF */
{0}};

Expand Down
7 changes: 7 additions & 0 deletions plugins/out_azure_kusto/azure_kusto.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@

#define FLB_AZURE_KUSTO_RESOURCES_LOAD_INTERVAL_SEC 3600

#define FLB_AZURE_KUSTO_INGEST_ENDPOINT_CONNECTION_TIMEOUT "60"
#define FLB_AZURE_KUSTO_KEEP_ALIVE_MAX_RECYCLE "20"

struct flb_azure_kusto_resources {
struct flb_upstream_ha *blob_ha;
struct flb_upstream_ha *queue_ha;
Expand All @@ -70,6 +73,10 @@ struct flb_azure_kusto {
flb_sds_t table_name;
flb_sds_t ingestion_mapping_reference;

/* connection configuration */
int ingestion_endpoint_connect_timeout;
int keep_alive_max_connection_recycle;

/* records configuration */
flb_sds_t log_key;
int include_tag_key;
Expand Down
5 changes: 5 additions & 0 deletions plugins/out_azure_kusto/azure_kusto_ingest.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ static flb_sds_t azure_kusto_create_blob(struct flb_azure_kusto *ctx, flb_sds_t

u_conn = flb_upstream_conn_get(u_node->u);

if (!u_conn) {
flb_plg_error(ctx->ins, "[out_azure_kusto] cannot create upstream connection while connecting to blob endpoint");
FLB_OUTPUT_RETURN(FLB_RETRY);
}

if (u_conn) {
uri = azure_kusto_create_blob_uri(ctx, u_node, blob_id);

Expand Down

0 comments on commit 80a424d

Please sign in to comment.