Skip to content

Commit

Permalink
out_azure_kusto: introduced gzip compression
Browse files Browse the repository at this point in the history
Signed-off-by: Tanmaya Panda <[email protected]>
  • Loading branch information
ag-ramachandran authored and tanmaya-panda1 committed Jul 5, 2024
1 parent b00f91d commit a70b60f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions plugins/out_azure_kusto/azure_kusto_ingest.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ static flb_sds_t azure_kusto_create_blob_uri(struct flb_azure_kusto *ctx,
size_t blob_uri_size;
char *blob_sas;
size_t blob_sas_size;
const char *extension;

if (ctx->compression_enabled) {
extension = ".multijson.gz";
}
else {
extension = ".multijson";
}

ret = flb_hash_table_get(u_node->ht, AZURE_KUSTO_RESOURCE_UPSTREAM_URI, 3,
(void **)&blob_uri, &blob_uri_size);
Expand All @@ -110,11 +118,11 @@ static flb_sds_t azure_kusto_create_blob_uri(struct flb_azure_kusto *ctx,

/* uri will be https://<blob_host>/<container_uri>/<blob_id>.multijson?<sas_token> */
uri = flb_sds_create_size(flb_sds_len(u_node->host) + blob_uri_size + blob_sas_size +
flb_sds_len(blob_id) + 21);
flb_sds_len(blob_id) + 11 + strlen(extension));

if (uri) {
flb_sds_snprintf(&uri, flb_sds_alloc(uri), "https://%s%s/%s.multijson?%s",
u_node->host, blob_uri, blob_id, blob_sas);
flb_sds_snprintf(&uri, flb_sds_alloc(uri), "https://%s%s/%s%s?%s",
u_node->host, blob_uri, blob_id, extension ,blob_sas);
flb_plg_debug(ctx->ins, "created blob uri %s", uri);
}
else {
Expand Down

0 comments on commit a70b60f

Please sign in to comment.