Exclusive Route
Routes events from one or more streams to unique sub-streams based on a set of user-defined conditions.
Routes events from one or more streams to unique sub-streams based on a set of user-defined conditions. Routes are evaluated in order and once an event matches a route, it is sent exclusively to that route and no further routes are evaluated.
Also, see the Route transform for routing an event to multiple streams.
Configuration
Example configurations
{
"transforms": {
"my_transform_id": {
"type": "exclusive_route",
"inputs": [
"my-source-or-transform-id"
],
"routes": {
"condition": null,
"name": null
}
}
}
}[transforms.my_transform_id]
type = "exclusive_route"
inputs = [ "my-source-or-transform-id" ]
[transforms.my_transform_id.routes]
transforms:
my_transform_id:
type: exclusive_route
inputs:
- my-source-or-transform-id
routes:
? condition
? name
{
"transforms": {
"my_transform_id": {
"type": "exclusive_route",
"inputs": [
"my-source-or-transform-id"
],
"routes": {
"condition": null,
"name": null
}
}
}
}[transforms.my_transform_id]
type = "exclusive_route"
inputs = [ "my-source-or-transform-id" ]
[transforms.my_transform_id.routes]
transforms:
my_transform_id:
type: exclusive_route
inputs:
- my-source-or-transform-id
routes:
? condition
? name
graph
optional objectExtra graph configuration
Configure output for component when generated with graph command
graph.edge_attributes
optional objectEdge attributes to add to the edges linked to this component’s node in resulting graph
They are added to the edge as provided
graph.edge_attributes.*
required objectgraph.edge_attributes.*.*
required string literalgraph.node_attributes
optional objectNode attributes to add to this component’s node in resulting graph
They are added to the node as provided
graph.node_attributes.*
required string literalinputs
required [string]A list of upstream source or transform IDs.
Wildcards (*) are supported.
See configuration for more info.
measure_cpu_usage
optional boolEnable CPU usage metrics for this transform.
When set to true, each poll of the transform task is timed using the OS thread CPU clock
and the accumulated nanoseconds are reported as the component_cpu_usage_ns_total counter,
tagged with component_id, component_kind, and component_type.
Defaults to false. Enable only for transforms where CPU attribution is needed, as it
adds a clock_gettime call on every future poll.
falseroutes
required [object]routes.condition
required condition*.source
type.*.type
Available syntaxes
| Syntax | Description | Example |
|---|---|---|
vrl | A Vector Remap Language (VRL) Boolean expression. | .status_code != 200 && !includes(["info", "debug"], .severity) |
datadog_search | A Datadog Search query string. | *stack |
is_log | Whether the incoming event is a log. | |
is_metric | Whether the incoming event is a metric. | |
is_trace | Whether the incoming event is a trace. | |
Shorthand for VRL
If you opt for the vrl syntax for this condition, you can set the condition
as a string via the condition parameter, without needing to specify both a source and a type. The
table below shows some examples:
| Config format | Example |
|---|---|
| YAML | condition: .status == 200 |
| TOML | condition = ".status == 200" |
| JSON | "condition": ".status == 200" |
Condition config examples
Standard VRL
*:
type: "vrl"
source: ".status == 500"* = { type = "vrl", source = ".status == 500" }"*": {
"type": "vrl",
"source": ".status == 500"
}Datadog Search
*:
type: "datadog_search"
source: "*stack"* = { type = "datadog_search", source = "*stack" }"*": {
"type": "datadog_search",
"source": "*stack"
}VRL shorthand
*: ".status == 500"* = ".status == 500""*": ".status == 500"routes.name
required string literalThe name of the route is also the name of the transform port.
The _unmatched name is reserved and thus cannot be used as route ID.
Each route can then be referenced as an input by other components with the name
<transform_name>.<name>. If an event doesn’t match any route,
it is sent to the <transform_name>._unmatched output.
Input Types
Outputs
<route_id>
<transform_name>.<route_id>.Output Types
Metrics
metric event.Traces
trace event.Logs
Warning
log event.Telemetry
Metrics
linkcomponent_discarded_events_total
counterfilter transform, or false if due to an error.component_errors_total
countercomponent_latency_mean_seconds
gaugeThe mean elapsed time, in fractional seconds, that an event spends in a single transform.
This includes both the time spent queued in the transform’s input buffer and the time spent executing the transform itself.
This value is smoothed over time using an exponentially weighted moving average (EWMA).
component_latency_seconds
histogramThe elapsed time, in fractional seconds, that an event spends in a single transform.
This includes both the time spent queued in the transform’s input buffer and the time spent executing the transform itself.
component_received_event_bytes_total
countercomponent_received_events_count
histogramA histogram of the number of events passed in each internal batch in Vector’s internal topology.
Note that this is separate than sink-level batching. It is mostly useful for low level debugging performance issues in Vector due to small internal batches.
component_received_events_total
countercomponent_sent_event_bytes_total
countercomponent_sent_events_total
countertransform_buffer_max_byte_size
gaugeDeprecated
transform_buffer_max_size_bytes.transform_buffer_max_event_size
gaugeDeprecated
transform_buffer_max_size_events.transform_buffer_max_size_bytes
gaugetransform_buffer_max_size_events
gaugetransform_buffer_utilization
histogramtransform_buffer_utilization_level
gaugetransform_buffer_utilization_mean
gaugeutilization
gaugeHow it works
Routing to multiple components
An event can only be routed to a single output.
The following is an example of how you can create two exclusive routes (plus the implicitly created _unmatched route).
transforms:
transform0:
inputs:
- source0
type: exclusive_route
routes:
- name: "a"
condition:
type: vrl
source: .level == 1
- name: "b"
condition:
type: vrl
# Note that the first condition is redundant. The previous route will always have precedence.
source: .level == 1 || .level == 2
tests:
- name: case-1
inputs:
- type: log
insert_at: transform0
log_fields:
level: 1
- type: log
insert_at: transform0
log_fields:
level: 2
outputs:
- extract_from: transform0.a
conditions:
- type: vrl
source: |
assert!(.level == 1)
- extract_from: transform0.b
conditions:
- type: vrl
source: |
assert!(.level == 2)