From f5aff6c08b314ec2640774b612317d188b239353 Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Tue, 6 Feb 2024 16:15:18 -0300 Subject: [PATCH 1/2] out_calyptia: register OS and architecture for agents. Signed-off-by: Phillip Whelan --- plugins/out_calyptia/calyptia.c | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/plugins/out_calyptia/calyptia.c b/plugins/out_calyptia/calyptia.c index 4f3a7f99fc6..6b346b57790 100644 --- a/plugins/out_calyptia/calyptia.c +++ b/plugins/out_calyptia/calyptia.c @@ -239,6 +239,52 @@ static flb_sds_t get_agent_metadata(struct flb_calyptia *ctx) msgpack_pack_str(&mp_pck, 9); msgpack_pack_str_body(&mp_pck, "community", 9); + flb_mp_map_header_append(&mh); + msgpack_pack_str(&mp_pck, 2); + msgpack_pack_str_body(&mp_pck, "os", 2); +#ifdef FLB_SYSTEM_WINDOWS + len = strlen("windows"); + msgpack_pack_str(&mp_pck); + msgpack_pack_str_body(&mp_pck, "windows", len); +#elif FLB_SYSTEM_MACOS + len = strlen("macos"); + msgpack_pack_str(&mp_pck, len); + msgpack_pack_str_body(&mp_pck, "macos", len); +#elif __linux__ + len = strlen("linux"); + msgpack_pack_str(&mp_pck, len); + msgpack_pack_str_body(&mp_pck, "linux", len); +#else + len = strlen("unknown"); + msgpack_pack_str(&mp_pck, len); + msgpack_pack_str_body(&mp_pck, "unknown", len); +#endif + + flb_mp_map_header_append(&mh); + msgpack_pack_str(&mp_pck, 4); + msgpack_pack_str_body(&mp_pck, "arch", 4); +#if defined(__arm__) || defined(_M_ARM) + len = strlen("arm"); + msgpack_pack_str(&mp_pck, len); + msgpack_pack_str_body(&mp_pck, "arm", len); +#elif defined(__aarch64__) + len = strlen("arm64"); + msgpack_pack_str(&mp_pck, len); + msgpack_pack_str_body(&mp_pck, "arm64", len); +#elif defined(__amd64__) || defined(_M_AMD64) + len = strlen("x86_64"); + msgpack_pack_str(&mp_pck, len); + msgpack_pack_str_body(&mp_pck, "x86_64", len); +#elif defined(__i686__) || defined(_M_I86) + len = strlen("x86"); + msgpack_pack_str(&mp_pck, len); + msgpack_pack_str_body(&mp_pck, "x86", len); +#else + len = strlen("unknown"); + msgpack_pack_str(&mp_pck, len); + msgpack_pack_str_body(&mp_pck, "unknown", len); +#endif + /* machineID */ flb_mp_map_header_append(&mh); msgpack_pack_str(&mp_pck, 9); From 64be7b12c3c5942ac1d4cda9640986f627f29c36 Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Tue, 6 Feb 2024 17:27:43 -0300 Subject: [PATCH 2/2] out_calyptia: add missing parameter for msgpack_str for windows os field. Signed-off-by: Phillip Whelan --- plugins/out_calyptia/calyptia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/out_calyptia/calyptia.c b/plugins/out_calyptia/calyptia.c index 6b346b57790..d3c13c4e859 100644 --- a/plugins/out_calyptia/calyptia.c +++ b/plugins/out_calyptia/calyptia.c @@ -244,7 +244,7 @@ static flb_sds_t get_agent_metadata(struct flb_calyptia *ctx) msgpack_pack_str_body(&mp_pck, "os", 2); #ifdef FLB_SYSTEM_WINDOWS len = strlen("windows"); - msgpack_pack_str(&mp_pck); + msgpack_pack_str(&mp_pck, len); msgpack_pack_str_body(&mp_pck, "windows", len); #elif FLB_SYSTEM_MACOS len = strlen("macos");