From a6d55d9bf4d439d1d747d0af6dd0570fc278a792 Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Tue, 7 Oct 2025 21:41:06 -0300 Subject: [PATCH 1/4] custom_calyptia: set net.* on in_calyptia_fleet. Signed-off-by: Phillip Whelan --- plugins/custom_calyptia/calyptia.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugins/custom_calyptia/calyptia.c b/plugins/custom_calyptia/calyptia.c index c296b944a29..1a7011ec234 100644 --- a/plugins/custom_calyptia/calyptia.c +++ b/plugins/custom_calyptia/calyptia.c @@ -215,6 +215,10 @@ flb_sds_t custom_calyptia_pipeline_config_get(struct flb_config *ctx) int set_fleet_input_properties(struct calyptia *ctx, struct flb_input_instance *fleet) { + struct mk_list *head; + struct mk_list *tmp; + struct flb_kv *keyval; + if (!fleet) { flb_plg_error(ctx->ins, "invalid fleet input instance"); return -1; @@ -255,6 +259,12 @@ int set_fleet_input_properties(struct calyptia *ctx, struct flb_input_instance * flb_input_set_property(fleet, "interval_nsec", ctx->fleet_interval_nsec); } + mk_list_foreach(head, &ctx->ins->net_properties) { + keyval = mk_list_entry(head, struct flb_kv, _head); + flb_debug("set fleet net property: %s=%s", keyval->key, keyval->val); + flb_input_set_property(fleet, keyval->key, keyval->val); + } + return 0; } @@ -267,6 +277,8 @@ static struct flb_output_instance *setup_cloud_output(struct flb_config *config, struct flb_slist_entry *val = NULL; flb_sds_t label; struct flb_config_map_val *mv; + struct mk_list *tmp; + struct flb_kv *keyval; cloud = flb_output_new(config, "calyptia", ctx, FLB_FALSE); @@ -354,6 +366,12 @@ static struct flb_output_instance *setup_cloud_output(struct flb_config *config, flb_sds_destroy(label); } + mk_list_foreach(head, &ctx->ins->net_properties) { + keyval = mk_list_entry(head, struct flb_kv, _head); + flb_debug("set cloud net property: %s=%s", keyval->key, keyval->val); + flb_output_set_property(cloud, keyval->key, keyval->val); + } + #ifdef FLB_HAVE_CHUNK_TRACE flb_output_set_property(cloud, "pipeline_id", ctx->pipeline_id); #endif /* FLB_HAVE_CHUNK_TRACE */ @@ -727,6 +745,7 @@ static struct flb_config_map config_map[] = { FLB_CONFIG_MAP_MULT, FLB_TRUE, offsetof(struct calyptia, add_labels), "Label to append to the generated metric." }, + { FLB_CONFIG_MAP_STR, "machine_id", NULL, 0, FLB_TRUE, offsetof(struct calyptia, machine_id), @@ -790,4 +809,5 @@ struct flb_custom_plugin custom_calyptia_plugin = { .config_map = config_map, .cb_init = cb_calyptia_init, .cb_exit = cb_calyptia_exit, + .flags = FLB_CUSTOM_NET_CLIENT, }; From 8c03d1eaef6af43d964a19ad4785298b7307187b Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Tue, 7 Oct 2025 21:42:48 -0300 Subject: [PATCH 2/4] in_calyptia_fleet: set upstream setting from the net.* properties. Signed-off-by: Phillip Whelan --- plugins/in_calyptia_fleet/in_calyptia_fleet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/in_calyptia_fleet/in_calyptia_fleet.c b/plugins/in_calyptia_fleet/in_calyptia_fleet.c index 00c3a868122..d6f0df8e941 100644 --- a/plugins/in_calyptia_fleet/in_calyptia_fleet.c +++ b/plugins/in_calyptia_fleet/in_calyptia_fleet.c @@ -2543,6 +2543,9 @@ static int in_calyptia_fleet_init(struct flb_input_instance *in, return -1; } + /* set upstream settings from 'net.*' */ + flb_input_upstream_set(ctx->u, ctx->ins); + /* Log initial interval values */ flb_plg_debug(ctx->ins, "initial collector interval: sec=%d nsec=%d", ctx->interval_sec, ctx->interval_nsec); From ad5abbdb7bfefae4db50d5d8fe18b277395eaf7e Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Tue, 7 Oct 2025 21:43:34 -0300 Subject: [PATCH 3/4] in_calyptia_fleet: recover net.* properties between fleet reloads. Signed-off-by: Phillip Whelan --- plugins/in_calyptia_fleet/in_calyptia_fleet.c | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/in_calyptia_fleet/in_calyptia_fleet.c b/plugins/in_calyptia_fleet/in_calyptia_fleet.c index d6f0df8e941..b65a556a96a 100644 --- a/plugins/in_calyptia_fleet/in_calyptia_fleet.c +++ b/plugins/in_calyptia_fleet/in_calyptia_fleet.c @@ -1883,6 +1883,7 @@ flb_sds_t fleet_config_get(struct flb_in_calyptia_fleet_config *ctx) } fleet_config_get_properties(&buf, &c_ins->properties, ctx->fleet_config_legacy_format); + fleet_config_get_properties(&buf, &c_ins->net_properties, ctx->fleet_config_legacy_format); if (flb_config_prop_get("fleet_id", &c_ins->properties) == NULL) { if (ctx->fleet_id != NULL) { From 7ac6dda02b4837e3357769c1ac3d521aa110bd4c Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Wed, 8 Oct 2025 11:21:55 -0300 Subject: [PATCH 4/4] tests/runtime/custom_calyptia: fix segfault due to incomplete init of custom calyptia plugin. Signed-off-by: Phillip Whelan --- tests/runtime/custom_calyptia_input_test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/runtime/custom_calyptia_input_test.c b/tests/runtime/custom_calyptia_input_test.c index 7b8be6b2a77..75d53add6ec 100644 --- a/tests/runtime/custom_calyptia_input_test.c +++ b/tests/runtime/custom_calyptia_input_test.c @@ -58,6 +58,8 @@ static struct test_context *init_test_context() return NULL; } + mk_list_init(&t_ctx->ctx->ins->net_properties); + /* Initialize test values in ctx */ t_ctx->ctx->api_key = flb_strdup("test_api_key"); t_ctx->ctx->fleet_config_dir = flb_strdup("/test/config/dir");