Skip to content

Commit f0c781b

Browse files
committed
redefine FLB_AZ_LI_DCE_URL_TMPLT to use stream_name
Signed-off-by: Jed Laundry <[email protected]>
1 parent 9652b0d commit f0c781b

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

plugins/out_azure_logs_ingestion/azure_logs_ingestion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"%s/oauth2/v2.0/token"
2929
/* DCE Full URL needs: dce_url, dcr_id, Log Analytics custom table name */
3030
#define FLB_AZ_LI_DCE_URL_TMPLT "%s/dataCollectionRules/%s/streams/"\
31-
"Custom-%s?"FLB_AZ_LI_API_VERSION
31+
"%s?"FLB_AZ_LI_API_VERSION
3232
/* TLS Modes for upstream connection = FLB_IO_TLS or FLB_IO_OPT_TLS*/
3333
#define FLB_AZ_LI_TLS_MODE FLB_IO_TLS
3434
/* refresh token every 60 minutes */

plugins/out_azure_logs_ingestion/azure_logs_ingestion_conf.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ struct flb_az_li* flb_az_li_ctx_create(struct flb_output_instance *ins,
9191
return NULL;
9292
}
9393

94+
/* config: 'stream_name' */
95+
if (!ctx->stream_name) {
96+
flb_plg_error(ins, "property 'stream_name' is not defined");
97+
flb_az_li_ctx_destroy(ctx);
98+
return NULL;
99+
}
100+
94101
/* Allocate and set auth url */
95102
ctx->auth_url = flb_sds_create_size(sizeof(FLB_AZ_LI_AUTH_URL_TMPLT) - 1 +
96103
flb_sds_len(ctx->tenant_id));
@@ -106,15 +113,15 @@ struct flb_az_li* flb_az_li_ctx_create(struct flb_output_instance *ins,
106113
ctx->dce_u_url = flb_sds_create_size(sizeof(FLB_AZ_LI_DCE_URL_TMPLT) - 1 +
107114
flb_sds_len(ctx->dce_url) +
108115
flb_sds_len(ctx->dcr_id) +
109-
flb_sds_len(ctx->table_name));
116+
flb_sds_len(ctx->stream_name));
110117
if (!ctx->dce_u_url) {
111118
flb_errno();
112119
flb_az_li_ctx_destroy(ctx);
113120
return NULL;
114121
}
115122
flb_sds_snprintf(&ctx->dce_u_url, flb_sds_alloc(ctx->dce_u_url),
116123
FLB_AZ_LI_DCE_URL_TMPLT, ctx->dce_url,
117-
ctx->dcr_id, ctx->table_name);
124+
ctx->dcr_id, ctx->stream_name);
118125

119126
/* Initialize the auth mutex */
120127
pthread_mutex_init(&ctx->token_mutex, NULL);
@@ -138,8 +145,8 @@ struct flb_az_li* flb_az_li_ctx_create(struct flb_output_instance *ins,
138145
}
139146
flb_output_upstream_set(ctx->u_dce, ins);
140147

141-
flb_plg_info(ins, "dce_url='%s', dcr='%s', table='%s', stream='Custom-%s'",
142-
ctx->dce_url, ctx->dcr_id, ctx->table_name, ctx->table_name);
148+
flb_plg_info(ins, "dce_url='%s', dcr='%s', table='%s', stream='%s'",
149+
ctx->dce_url, ctx->dcr_id, ctx->table_name, ctx->stream_name);
143150

144151
return ctx;
145152
}

0 commit comments

Comments
 (0)