WASM Input Plugins
Fluent Bit currently supports integration of wasm plugins built as wasm/wasi objects for input and filter plugins only. The interface for the WASM filter plugins is currently under development but is functional.
There are no additional requirements to execute WASM plugins.
Currently, fluent-bit supports the following WASM toolchains:
- Rust on
- rustc 1.62.1 (e092d0b6b 2022-07-16) or later
Compile Fluent Bit with WASM support, e.g:
$ cd build/
$ cmake ..
Once compiled, we can see new plugins in which handles wasm, e.g:
$ bin/fluent-bit -h
Usage: fluent-bit [OPTION]
# ... other input plugin stuffs
exec_wasi Exec WASI Input
# ... other filter plugin stuffs
wasm WASM program filter
Currently, Fluent Bit's WASM input assumes WASI ABI that is also known as
wasm32-wasion Rust target and
wasm32-wasion TinyGo target.
$ rustup target add wasm32-wasi
WASM input plugins execute the function that has wasi main function entrypoint. And Fluent Bit's WASM input plugin communicates via stdout on WASM programs.
WASM programs should handle stdout for ingesting logs into Fluent Bit.
Once built, a WASM/WASI program will be available. Then, that built program can be executed with the following Fluent Bit configuration:
# For security reasons, WASM/WASI program cannot access its outer world
# without accessible permissions.
# accessible_paths .,/path/to/fluent-bit
For further example that handles structured logs, fluent-bit has a Rust serde-json example: https://github.com/fluent/fluent-bit/tree/master/examples/wasi_serde_json