Skip to content

Commit 4724744

Browse files
dceraviguptanourdouf
authored andcommitted
out_azure_kusto: support for otel log schema (fluent#10173)
--------- Signed-off-by: Ravi Gupta <[email protected]>
1 parent 1a46452 commit 4724744

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

plugins/out_azure_kusto/azure_kusto.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,7 @@ static int azure_kusto_format(struct flb_azure_kusto *ctx, const char *tag, int
959959
const void *data, size_t bytes, void **out_data,
960960
size_t *out_size)
961961
{
962+
int index;
962963
int records = 0;
963964
msgpack_sbuffer mp_sbuf;
964965
msgpack_packer mp_pck;
@@ -1034,7 +1035,28 @@ static int azure_kusto_format(struct flb_azure_kusto *ctx, const char *tag, int
10341035
msgpack_pack_str(&mp_pck, flb_sds_len(ctx->log_key));
10351036
msgpack_pack_str_body(&mp_pck, ctx->log_key, flb_sds_len(ctx->log_key));
10361037

1037-
if (log_event.body != NULL) {
1038+
if (log_event.group_attributes != NULL && log_event.body != NULL) {
1039+
msgpack_pack_map(&mp_pck,
1040+
log_event.group_attributes->via.map.size +
1041+
log_event.metadata->via.map.size +
1042+
log_event.body->via.map.size);
1043+
1044+
for (index = 0; index < log_event.group_attributes->via.map.size; index++) {
1045+
msgpack_pack_object(&mp_pck, log_event.group_attributes->via.map.ptr[index].key);
1046+
msgpack_pack_object(&mp_pck, log_event.group_attributes->via.map.ptr[index].val);
1047+
}
1048+
1049+
for (index = 0; index < log_event.metadata->via.map.size; index++) {
1050+
msgpack_pack_object(&mp_pck, log_event.metadata->via.map.ptr[index].key);
1051+
msgpack_pack_object(&mp_pck, log_event.metadata->via.map.ptr[index].val);
1052+
}
1053+
1054+
for (index = 0; index < log_event.body->via.map.size; index++) {
1055+
msgpack_pack_object(&mp_pck, log_event.body->via.map.ptr[index].key);
1056+
msgpack_pack_object(&mp_pck, log_event.body->via.map.ptr[index].val);
1057+
}
1058+
}
1059+
else if (log_event.body != NULL) {
10381060
msgpack_pack_object(&mp_pck, *log_event.body);
10391061
}
10401062
else {

0 commit comments

Comments
 (0)