The following repository provides the structure and build-system helpers to develop C dynamic plugins for Fluent Bit like inputs, filters and outputs.
Fluent Bit API development/usage is out of the scope of this article.
In the following steps we will build the example plugin provided called __out_stdout2__. As a first step get into the build/ directory:
$ cd build/
Now we will provide CMake (our build system) two important variables:
Assuming that Fluent Bit source code is located at /tmp/fluent-bit and we will build out_stdout2, we will run CMake with the following options:
$ cmake -DFLB_SOURCE=/tmp/fluent-bit -DPLUGIN_NAME=out_stdout2 ../
then type 'make' to build the plugin:
$ make
Scanning dependencies of target flb-out_stdout2
[ 50%] Building C object out_stdout2/CMakeFiles/flb-out_stdout2.dir/stdout2.c.o
[100%] Linking C shared library ../flb-out_stdout2.so
[100%] Built target flb-out_stdout2
If you query the content of the current directory you will find the new shared library created:
$ ls -l *.so
-rwxr-xr-x 1 edsiper edsiper 17288 jun 20 16:33 flb-out_stdout2.so
that .so file is our dynamic plugin that now can be loaded from Fluent Bit through the plugins configuration file.
This program is under the terms of the Apache License v2.0.