> For the complete documentation index, see [llms.txt](https://docs.fluentbit.io/manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fluentbit.io/manual/data-pipeline/filters/wasm.md).

# Wasm

Use Wasm programs as a filter.

{% hint style="info" %}
**Supported event types:** `logs`
{% endhint %}

The *Wasm* filter lets you modify the incoming records using [Wasm](https://webassembly.org/) technology.

You can extend Fluent Bit capabilities by writing custom filters using built Wasm programs and its runtime. A Wasm-based filter takes the following steps:

1. (Optional) Compile Ahead Of Time (AOT) objects to optimize the Wasm execution pipeline.
2. Configure the filter in the main configuration.
3. Prepare a Wasm program that will be used by the filter.

## Configuration parameters

The plugin supports the following configuration parameters:

| Key                | Description                                                                                                                                      |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `accessible_paths` | Specify the allowlist of paths to be able to access paths from Wasm programs. Default: `.` (current directory).                                  |
| `event_format`     | Define event format to interact with Wasm programs: `msgpack` or `json`. Default: `json`.                                                        |
| `function_name`    | Wasm function name that will be triggered to do filtering. It's assumed that the function is built inside the Wasm program specified previously. |
| `wasm_heap_size`   | Size of the heap size of Wasm execution. Review [unit sizes](/manual/administration/configuring-fluent-bit.md#unit-sizes) for allowed values.    |
| `wasm_path`        | Path to the built Wasm program that will be used. This can be a path relative to the main configuration file.                                    |
| `wasm_stack_size`  | Size of the stack size of Wasm execution. Review [unit sizes](/manual/administration/configuring-fluent-bit.md#unit-sizes) for allowed values.   |

## Configuration example

Here is a configuration example.

{% tabs %}
{% tab title="fluent-bit.yaml" %}

```yaml
pipeline:
  inputs:
    - name: dummy
      tag: dummy.local

  filters:
    - name: wasm
      match: 'dummy.*'
      event_format: json    # or msgpack
      wasm_path: /path/to/wasm_program.wasm
      function_name: filter_function_name
      # Note: run Fluent Bit from the 'wasm_path' location.
      accessible_paths: /path/to/accessible

  outputs:
    - name: stdout
      match: '*'
```

{% endtab %}

{% tab title="fluent-bit.conf" %}

```
[INPUT]
  Name   dummy
  Tag    dummy.local

[FILTER]
  Name             wasm
  Match            dummy.*
  Event_Format     json # or msgpack
  Wasm_Path        /path/to/wasm_program.wasm
  Function_Name    filter_function_name
  Accessible_Paths .,/path/to/accessible

[OUTPUT]
  Name   stdout
  Match  *
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.fluentbit.io/manual/data-pipeline/filters/wasm.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
