Skip to content

Latest commit

 

History

History
118 lines (85 loc) · 4.53 KB

sampler.md

File metadata and controls

118 lines (85 loc) · 4.53 KB
description Accepts `log` events and allows you to sample events with a configurable rate.

sampler transform

{% hint style="warning" %} The sampler transform is in beta. Please see the current enhancements and bugs for known issues. We kindly ask that you add any missing issues as it will help shape the roadmap of this component. {% endhint %}

The sampler transform accepts log events and allows you to sample events with a configurable rate.

Example

{% code-tabs %} {% code-tabs-item title="vector.toml (simple)" %}

[transforms.my_transform_id]
  type = "sampler" # must be: "sampler"
  inputs = ["my-source-id"]
  rate = 10

{% endcode-tabs-item %} {% code-tabs-item title="vector.toml (advanced)" %}

[transforms.my_transform_id]
  # REQUIRED
  type = "sampler" # must be: "sampler"
  inputs = ["my-source-id"]
  rate = 10
  
  # OPTIONAL
  pass_list = ["[error]", "field2"] # no default

{% endcode-tabs-item %} {% endcode-tabs %}

Options

pass_list

optional no default type: [string] example: ["[error]", "field2"]

A list of regular expression patterns to exclude events from sampling. If an event's "message" key matches any of these patterns it will not be sampled.

rate

required type: int example: 10

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.

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.

Troubleshooting

The best place to start with troubleshooting is to check the Vector logs. This is typically located at /var/log/vector.log, then proceed to follow the Troubleshooting Guide.

If the Troubleshooting Guide does not resolve your issue, please:

  1. Check for any open sampler_transform issues.
  2. If encountered a bug, please file a bug report.
  3. If encountered a missing feature, please file a feature request.
  4. If you need help, join our chat/forum community. You can post a question and search previous questions.

Alternatives

Finally, consider the following alternatives:

Resources