Fluent Bit and Golang Plugins
Compile Fluent Bit with Golang support, e.g:
Once compiled, we can see a new option in the binary which stands for external plugin, e.g:
$ bin/fluent-bit -h
Usage: fluent-bit [OPTION]
Available Options
-c --config=FILE specify an optional configuration file
-f, --flush=SECONDS flush timeout in seconds (default: 5)
-i, --input=INPUT set an input
-o, --output=OUTPUT set an output
-p, --prop="A=B" set plugin configuration property
...
https://github.com/fluent/fluent-bit-go
At a minimum, a Go plugin looks like this:
To build the code above, use the following line:
$ go build -buildmode=c-shared -o out_gstdout.so out_gstdout.go
Once built, a shared library called out\_gstdout.so
will be available. It’s really important to double check the final .so file is what we expect. Doing a over the library we should see something similar to this: