fluent / fluent-bit-go

Fluent Bit Golang package to build plugins
Apache License 2.0
189 stars 52 forks source link

How to load with the C api? #57

Closed Minipada closed 1 year ago

Minipada commented 1 year ago

Hi, I am trying to load the gstdout as a starting point with the C api. What I did:

  1. added a wrapper to flb_plugin_proxy_create in flb_lib to export it
  2. in my c program, call the wrapped function with the so path
  3. load output: outffd = flboutput(ctx, "gstdout", NULL); flb_outputset(ctx, outffd, "match", '*', NULL); flb_outputset(ctx, outffd, "param", "a,b,c", NULL);

I am using the master branch of fluentbit, and tested to run with the CLI, which works

The prgram crashes instantly, without information...Am I missing something?

Minipada commented 1 year ago

So, the problem was caused by the match line. Somehow, the single quote for the * element causes the crash. I suppose there are some internals where it picks up the string size but expand the star to something else... Anyway,

TLDR: *use ""** for the match