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.
Also, see the [Route](/docs/reference/configuration/transforms/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.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.
routes
required [object]Outputs
<route_id>
<transform_name>.<route_id>
.Telemetry
Metrics
linkcomponent_discarded_events_total
counterfilter
transform, or false if due to an error.component_errors_total
countercomponent_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
counterutilization
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)