From 8b707385c2244ad9417a6a34bc957a2de9c9e116 Mon Sep 17 00:00:00 2001 From: jmccormick7 Date: Fri, 10 Oct 2025 13:22:00 -0400 Subject: [PATCH 1/2] plugin_proxy: enable event_type specification for proxy plugins This commit adds event_type to the flb_plugin_proxy_def struct. This allows for the setting of event_type to a value other than the default log only initialization. In the flb_plugin_proxy_register function default behaviour is enforced by checking for unset event_type vlaues. When unset (a value of 0) then log behaviour is defaulted. No need for incorrect value checking since this was not a set field in the past. Unset fields are set as current behavior dicates and future usecases using incorrect values can be treated as user error. Input use case does not use event-type and is unaffected by this change. Signed-off-by: jmccormick7 --- include/fluent-bit/flb_plugin_proxy.h | 1 + src/flb_plugin_proxy.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/fluent-bit/flb_plugin_proxy.h b/include/fluent-bit/flb_plugin_proxy.h index fb245291bd1..8e534ecdf75 100644 --- a/include/fluent-bit/flb_plugin_proxy.h +++ b/include/fluent-bit/flb_plugin_proxy.h @@ -40,6 +40,7 @@ struct flb_plugin_proxy_def { int flags; char *name; /* plugin short name */ char *description; /* plugin description */ + int event_type; /* event type (logs/metrics/traces) */ }; /* Proxy context */ diff --git a/src/flb_plugin_proxy.c b/src/flb_plugin_proxy.c index 2ec84b546c5..e97890d017f 100644 --- a/src/flb_plugin_proxy.c +++ b/src/flb_plugin_proxy.c @@ -362,6 +362,14 @@ static int flb_proxy_register_output(struct flb_plugin_proxy *proxy, out->flags = def->flags; out->name = flb_strdup(def->name); + /* If event_type is unset (0) then default to logs (this is the current behavior) */ + if (def->event_type == 0) { + out->event_type = FLB_OUTPUT_LOGS; + } + else { + out->event_type = def->event_type; + } + out->description = def->description; mk_list_add(&out->_head, &config->out_plugins); @@ -396,6 +404,7 @@ static int flb_proxy_register_input(struct flb_plugin_proxy *proxy, in->flags = def->flags | FLB_INPUT_THREADED; in->name = flb_strdup(def->name); in->description = def->description; + mk_list_add(&in->_head, &config->in_plugins); /* From 82d792a5c4ac43050a5c617c1dc56f646e816f46 Mon Sep 17 00:00:00 2001 From: jmccormick7 Date: Fri, 10 Oct 2025 15:13:02 -0400 Subject: [PATCH 2/2] plugin_proxy: change proxydef initialization to use calloc instead of malloc Changing intialization to use calloc instead of malloc so that emtpy fields are 0 initialized. Specifically for the event_type addition. Signed-off-by: jmccormick7 --- src/flb_plugin_proxy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flb_plugin_proxy.c b/src/flb_plugin_proxy.c index e97890d017f..8a58181b803 100644 --- a/src/flb_plugin_proxy.c +++ b/src/flb_plugin_proxy.c @@ -621,7 +621,7 @@ struct flb_plugin_proxy *flb_plugin_proxy_create(const char *dso_path, int type, return NULL; } - proxy->def = flb_malloc(sizeof(struct flb_plugin_proxy_def)); + proxy->def = flb_calloc(1, sizeof(struct flb_plugin_proxy_def)); if (!proxy->def) { flb_errno(); dlclose(handle);