Skip to content

Commit

Permalink
out_calyptia: register OS and architecture for agents.
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Whelan <phil@calyptia.com>
  • Loading branch information
pwhelan authored and edsiper committed Sep 26, 2024
1 parent 013837a commit 530b42a
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions plugins/out_calyptia/calyptia.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 530b42a

Please sign in to comment.