Wasm input plugins

WebAssemblyarrow-up-right (Wasm) is a binary instruction format for stack-based virtual machines.

Fluent Bit supports integration of Wasm plugins built as Wasm/WASI objects for inputs and filter plugins only. The interface for Wasm filter plugins is currently under development but is functional.

Prerequisites

Build Fluent Bit

There are no additional requirements to execute Wasm plugins.

For Wasm programs

Fluent Bit supports the following Wasm tool chains:

Get started

Compile Fluent Bit with Wasm support. For example:

Once compiled, you can see new plugins that handle wasm. For example:

Build a Wasm input for input plugin

Wasm input in Fluent Bit assumes WASI ABI, also known as wasm32-wasi on Rust target and wasm32-wasi on TinyGo target.

Install additional components

TinyGo and WASI SDK support Wasm target by default. When using Rust's wasm32-wasi target, you must install wasm32-wasi by using rustuparrow-up-right. Then, install the target components as:

Requirements of Wasm/WASI programs

Wasm input plugins execute the function that has a WASI main function entrypoint, and Wasm input plugins in Fluent Bit communicate through 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 you can execute that program with one of the following Fluent Bit configurations:

For an example that handles structured logs, see the Rust serde-json examplearrow-up-right.

Last updated

Was this helpful?