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:

    1. $ bin/fluent-bit -h
    2. Usage: fluent-bit [OPTION]
    3. Available Options
    4. -c --config=FILE specify an optional configuration file
    5. -f, --flush=SECONDS flush timeout in seconds (default: 5)
    6. -i, --input=INPUT set an input
    7. -o, --output=OUTPUT set an output
    8. -p, --prop="A=B" set plugin configuration property
    9. ...

    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:

    1. $ 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: