Skip to content
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

LUA filter inline code support #1081

Merged
merged 2 commits into from
Mar 8, 2024
Merged

LUA filter inline code support #1081

merged 2 commits into from
Mar 8, 2024

Conversation

chrono2002
Copy link

Adds support for "code:" inline block in LUA namespace-wide filter.
See: https://docs.fluentbit.io/manual/pipeline/filters/lua
"code | Inline LUA code instead of loading from a path via script."

None
Usage:

apiVersion: fluentbit.fluent.io/v1alpha2
kind: Filter
metadata:
  labels:
    fluentbit.fluent.io/enabled: "true"
  name: test
spec:
  match: "*"
  filters:
  - lua:
      call: converter
      protectedMode: true 
      code: |
        function converter(tag, timestamp, record)
            return 0, 0, 0
        end

Signed-off-by: Paul Smith <[email protected]>
@@ -45,7 +48,28 @@ func (l *Lua) Params(_ plugins.SecretLoader) (*params.KVs, error) {
if err != nil {
return kvs, err
}
kvs.Insert("script", "/fluent-bit/config/"+l.Script.Key)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @chrono2002 , looks like there're indent issues here.
You may need to run :

make generate
make manifests
make fmt
make vet
make docs-update

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Signed-off-by: Paul Smith <[email protected]>
@chrono2002 chrono2002 requested a review from benjaminhuo March 7, 2024 19:27
@benjaminhuo benjaminhuo merged commit 0957492 into fluent:master Mar 8, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants