WebAssembly (Wasm) transform

Modify events using an embedded WebAssembly (Wasm) virtual machine

egress: stream state: stateful

Note this component was removed in v0.17.0.

Process events using the WASM virtual machine, allowing you to process Vector events with Typescript, Ruby, Java, and more.

Requirements

Vector must be built with the wasm feature. This is not enabled by default. See the Building Vector docs for more info.*

Warnings

The wasm transform has been deprecated and will be removed in v0.17.0.

In its place, the lua transform can be used for custom logic that cannot be covered by the remap transform.

See the v0.16.0 release highlight for more details on this deprecation.

Configuration

Example configurations

{
  "transforms": {
    "my_transform_id": {
      "type": "wasm",
      "inputs": [
        "my-source-or-transform-id"
      ],
      "artifact_cache": "/etc/vector/artifacts",
      "module": "./modules/example.wasm"
    }
  }
}
[transforms.my_transform_id]
type = "wasm"
inputs = [ "my-source-or-transform-id" ]
artifact_cache = "/etc/vector/artifacts"
module = "./modules/example.wasm"
---
transforms:
  my_transform_id:
    type: wasm
    inputs:
      - my-source-or-transform-id
    artifact_cache: /etc/vector/artifacts
    module: ./modules/example.wasm
{
  "transforms": {
    "my_transform_id": {
      "type": "wasm",
      "inputs": [
        "my-source-or-transform-id"
      ],
      "artifact_cache": "/etc/vector/artifacts",
      "heap_max_size": 10485760,
      "module": "./modules/example.wasm"
    }
  }
}
[transforms.my_transform_id]
type = "wasm"
inputs = [ "my-source-or-transform-id" ]
artifact_cache = "/etc/vector/artifacts"
heap_max_size = 10_485_760
module = "./modules/example.wasm"
---
transforms:
  my_transform_id:
    type: wasm
    inputs:
      - my-source-or-transform-id
    artifact_cache: /etc/vector/artifacts
    heap_max_size: 10485760
    module: ./modules/example.wasm

artifact_cache

required string file_system_path
The directory where Vector should store the artifact it builds of this WASM module. Typically, all WASM modules share this.
Examples
"/etc/vector/artifacts"
"/var/lib/vector/artifacts"
"C:\\vector\\artifacts"

heap_max_size

optional uint
The maximum size of the heap of this module, in bytes. (This includes the module itself, default is 10 MB.)
default: 1.048576e+07 (bytes)

inputs

required [string]

A list of upstream source or transform IDs. Wildcards (*) are supported.

See configuration for more info.

Array string literal
Examples
[
  "my-source-or-transform-id",
  "prefix-*"
]

module

required string file_system_path
The file path of the .wasm or .wat module.
Examples
"./modules/example.wasm"
"/example.wat"
"example.wasm"

Telemetry

Metrics

link

component_received_event_bytes_total

counter
The number of event bytes accepted by this component either from tagged origins like file and uri, or cumulatively from other origins.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host required
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid required
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_received_events_total

counter
The number of events accepted by this component either from tagged origins like file and uri, or cumulatively from other origins.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host required
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid required
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_sent_event_bytes_total

counter
The total number of event bytes emitted by this component.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

component_sent_events_total

counter
The total number of events emitted by this component.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

events_in_total

counter
The number of events accepted by this component either from tagged origins like file and uri, or cumulatively from other origins. This metric is deprecated and will be removed in a future version. Use component_received_events_total instead.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host required
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid required
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

events_out_total

counter
The total number of events emitted by this component. This metric is deprecated and will be removed in a future version. Use component_sent_events_total instead.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

processed_bytes_total

counter
The number of bytes processed by the component.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
container_name optional
The name of the container from which the bytes originate.
file optional
The file from which the bytes originate.
host required
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the bytes originate.
peer_path optional
The pathname from which the bytes originate.
pid required
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the bytes originate.
uri optional
The sanitized URI from which the bytes originate.

processed_events_total

counter
The total number of events processed by this component. This metric is deprecated in place of using component_received_events_total and component_sent_events_total metrics.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

utilization

gauge
A ratio from 0 to 1 of the load on a component. A value of 0 would indicate a completely idle component that is simply waiting for input. A value of 1 would indicate a that is never idle. This value is updated every 5 seconds.
component_id required
The Vector component ID.
component_kind required
The Vector component kind.
component_name required
Deprecated, use component_id instead. The value is the same as component_id.
component_type required
The Vector component type.
host required
The hostname of the system Vector is running on.
pid required
The process ID of the Vector instance.

How it works

State

This component is stateful, meaning its behavior changes based on previous inputs (events). State is not preserved across restarts, therefore state-dependent behavior will reset between restarts and depend on the inputs (events) received since the most recent restart.