-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
filter_lua: add support for log metadata handling #9702
base: master
Are you sure you want to change the base?
Conversation
Hi @edsiper ! Not sure if you saw, but a few months ago I created a PR which exposes log metadata to Lua in a backwards compatible way: #9323 . #9323 adds a new processor, so internally it is not compatible with filter API. In any case I thought you might find it useful to look at how the public Lua API looks like there, so it could potentially be implemented in a similar manner. |
they @tarruda thanks for reviewing this :) , and thanks for the hints to review the other PRs, definitely I will borrow some of it |
Signed-off-by: Eduardo Silva <eduardo@calyptia.com>
This new C function inspects a Lua function and sets in a new context the number of expected parameters and also specify if is variadic or not. This is a helper function to validate definitions. int flb_lua_get_func_info(lua_State *lua, char *func, struct flb_lua_func_info *info); the new info structure is as follows: struct flb_lua_func_info { int params; int is_variadic; }; Signed-off-by: Eduardo Silva <eduardo@calyptia.com>
This patch makes the plugin to validate the expected number of arguments for the callback function definition . When API v1 is expected, it expects 3 parameters (tag, timestamp, body), for v2 it expects (tag, timestamp metadata, body). Signed-off-by: Eduardo Silva <eduardo@calyptia.com>
Signed-off-by: Eduardo Silva <eduardo@calyptia.com>
DRAFT PR
Introduces a v2 APi for the Lua functions that allows the handling of Log metadata, e.g:
output:
update: Dec 24, 2024
I have been thinking in the future of this plugin and while adding metadata support as an extra argument to the Lua callback solves the problem, it seems we need a more flexible solution since we will implement also support for metrics and traces, couple of things I have in mind for API
v2
(without breaking compatibility with v1):v2
can only be enabled if the plugin runs as a processor instead of a common filter.cc: adding @niedbalski for visibility.
This is work in progress.
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.