From 27718ce705d3c621f706be8f5be73bc269ca809a Mon Sep 17 00:00:00 2001 From: Tanmaya Panda Date: Wed, 21 Feb 2024 10:25:19 +0530 Subject: [PATCH] made refresh interval configurable Signed-off-by: Tanmaya Panda --- plugins/out_azure_kusto/azure_kusto.c | 4 ++++ plugins/out_azure_kusto/azure_kusto.h | 4 +++- plugins/out_azure_kusto/azure_kusto_conf.c | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/out_azure_kusto/azure_kusto.c b/plugins/out_azure_kusto/azure_kusto.c index 952cb375b4c..4431246fcd7 100644 --- a/plugins/out_azure_kusto/azure_kusto.c +++ b/plugins/out_azure_kusto/azure_kusto.c @@ -522,6 +522,10 @@ static struct flb_config_map config_map[] = { {FLB_CONFIG_MAP_BOOL, "compression_enabled", "true", 0, FLB_TRUE, offsetof(struct flb_azure_kusto, compression_enabled), "Enable HTTP payload compression (gzip)." }, + {FLB_CONFIG_MAP_TIME, "ingestion_resources_refresh_interval", FLB_AZURE_KUSTO_RESOURCES_LOAD_INTERVAL_SEC,0, FLB_TRUE, + offsetof(struct flb_azure_kusto, ingestion_resources_refresh_interval), + "Set the azure kusto ingestion resources refresh interval" + }, /* EOF */ {0}}; diff --git a/plugins/out_azure_kusto/azure_kusto.h b/plugins/out_azure_kusto/azure_kusto.h index 9136f25294a..9e3eb7b3182 100644 --- a/plugins/out_azure_kusto/azure_kusto.h +++ b/plugins/out_azure_kusto/azure_kusto.h @@ -49,7 +49,7 @@ #define AZURE_KUSTO_RESOURCE_UPSTREAM_URI "uri" #define AZURE_KUSTO_RESOURCE_UPSTREAM_SAS "sas" -#define FLB_AZURE_KUSTO_RESOURCES_LOAD_INTERVAL_SEC 7200 +#define FLB_AZURE_KUSTO_RESOURCES_LOAD_INTERVAL_SEC "3600" #define FLB_AZURE_KUSTO_INGEST_ENDPOINT_CONNECTION_TIMEOUT "60" @@ -78,6 +78,8 @@ struct flb_azure_kusto { /* compress payload */ int compression_enabled; + int ingestion_resources_refresh_interval; + /* records configuration */ flb_sds_t log_key; int include_tag_key; diff --git a/plugins/out_azure_kusto/azure_kusto_conf.c b/plugins/out_azure_kusto/azure_kusto_conf.c index 79ff26cba28..e9d77c6ce34 100644 --- a/plugins/out_azure_kusto/azure_kusto_conf.c +++ b/plugins/out_azure_kusto/azure_kusto_conf.c @@ -455,12 +455,12 @@ int azure_kusto_load_ingestion_resources(struct flb_azure_kusto *ctx, /* check if we have all resources and they are not stale */ if (ctx->resources->blob_ha && ctx->resources->queue_ha && ctx->resources->identity_token && - now - ctx->resources->load_time < FLB_AZURE_KUSTO_RESOURCES_LOAD_INTERVAL_SEC + generated_random_integer) { + now - ctx->resources->load_time < ctx->ingestion_resources_refresh_interval + generated_random_integer) { flb_plg_debug(ctx->ins, "resources are already loaded and are not stale"); ret = 0; } else { - flb_plg_info(ctx->ins, "loading kusto ingestion resourcs and refresh interval is %d", ,FLB_AZURE_KUSTO_RESOURCES_LOAD_INTERVAL_SEC + generated_random_integer); + flb_plg_info(ctx->ins, "loading kusto ingestion resourcs and refresh interval is %d", ,ctx->ingestion_resources_refresh_interval + generated_random_integer); response = execute_ingest_csl_command(ctx, ".get ingestion resources"); if (response) {