WASM Transform

The Vector wasm transform accepts and outputs log events, allowing you to execute experimental WASM plugins.

Requirements

Configuration

vector.toml
[transforms.my_transform_id]
type = "wasm" # required
inputs = ["my-source-or-transform-id"] # required
artifact_cache = "/etc/vector/artifacts" # required
heap_max_size = 10485760 # optional, default
module = "./modules/example.wasm" # required

Options

  • stringcommonrequired

    artifact_cache

    The directory where Vector should store the artifact it builds of this WASM module. Typically, all WASM modules share this.

    • No default
    • View examples
  • intcommonoptional

    heap_max_size

    The maximum size of the heap of this module, in bytes. (This includes the module itself, default is 10 MB.)

    • Default: 10485760
  • stringcommonrequired

    module

    The file path of the .wasm or .wat module.

    • No default
    • View examples

Examples

Given the following configuration:

vector.toml
[transforms.test]
inputs = [...]
type = "wasm"
module = "module.wasm"
artifact_cache = "artifacts/"

Accompanied by a module.wasm file built via cargo +nightly --target wasm32-wasi ..., Vector will use the module as a custom transform.

How It Works

Environment Variables

Environment variables are supported through all of Vector's configuration. Simply add ${MY_ENV_VAR} in your Vector configuration file and the variable will be replaced before being evaluated.

You can learn more in the Environment Variables section.