Exclusive Route

Routes events from one or more streams to unique sub-streams based on a set of user-defined conditions.

status: beta egress: stream state: stateless

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 object

Extra graph configuration

Configure output for component when generated with graph command

graph.node_attributes

optional object

Node attributes to add to this component’s node in resulting graph

They are added to the node as provided

graph.node_attributes.*
required string literal
A single graph node attribute in graphviz DOT language.
Examples
{
  "color": "red",
  "name": "Example Node",
  "width": "5.0"
}

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-*"
]

routes

required [object]
An array of named routes. The route names are expected to be unique.
Array object
Examples
[
  {
    "condition": {
      "source": "exists(.foo) \u0026\u0026 exists(.bar)",
      "type": "vrl"
    },
    "name": "foo-and-bar-exist"
  },
  {
    "condition": {
      "source": "exists(.foo)",
      "type": "vrl"
    },
    "name": "only-foo-exists"
  }
]

Outputs

<route_id>

Each route can be referenced as an input by other components with the name <transform_name>.<route_id>.

Telemetry

Metrics

link

component_discarded_events_total

counter
The number of events dropped by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
intentional
True if the events were discarded intentionally, like a filter transform, or false if due to an error.
pid optional
The process ID of the Vector instance.

component_errors_total

counter
The total number of errors encountered by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
error_type
The type of the error
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.
stage
The stage within the component at which the error occurred.

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
The Vector component ID.
component_kind
The Vector component kind.
component_type
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 optional
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 optional
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_count

histogram

A 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_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
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 optional
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 optional
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
The Vector component ID.
component_kind
The Vector component kind.
component_type
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 optional
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 optional
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
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

component_sent_events_total

counter
The total number of events emitted by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
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
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.

How 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)

State

This component is stateless, meaning its behavior is consistent across each input.