Sampler Transform

The Vector sampler transform accepts and outputs log events allowing you to sample events with a configurable rate.

Configuration

vector.toml
[transforms.my_transform_id]
type = "sampler" # required
inputs = ["my-source-id"] # required
pass_list = ["[error]", "field2"] # optional, no default
rate = 10 # required
  • stringoptional

    key_field

    The name of the log field to use to determine if the event should be passed. This defaults to the global message_key option.

    • No default
    • View examples
  • [string]commonoptional

    pass_list

    A list of regular expression patterns to exclude events from sampling. If an event's key field (see key_field) matches any of these patterns it will not be sampled.

    • No default
    • View examples
  • intcommonrequired

    rate

    The rate at which events will be forwarded, expressed as 1/N. For example, rate = 10 means 1 out of every 10 events will be forwarded and the rest will be dropped.

    • No default
    • View examples

How It Works

Complex Processing

If you encounter limitations with the sampler transform then we recommend using a runtime transform. These transforms are designed for complex processing and give you the power of full programming runtime.

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.