Routing Connector
contrib, k8s
Maintainers: @TylerHelmuth, @evan-bradley, @edmocosta, @bogdandrutu
Source: opentelemetry-collector-contrib
Overview
Routes logs, metrics or traces based on resource attributes to specific pipelines using OpenTelemetry Transformation Language (OTTL) statements as routing conditions.Configuration
If you are not already familiar with connectors, you may find it helpful to first visit the Connectors README. The following settings are available:table (required): the routing table for this connector.table.context (optional, default: resource): the OTTL Context in which the statement will be evaluated. Currently, onlyresource,span,metric,datapoint,log, andrequestare supported.table.statement: the routing condition provided as the OTTL statement. Required iftable.conditionis not provided. May not be used forrequestcontext.table.condition: the routing condition provided as the OTTL condition. Required iftable.statementis not provided. Required forrequestcontext.table.action (optional, default: move): determines what happens to the data when the routing condition is met. Valid values aremoveandcopy.move: Matched data is moved to the target pipeline(s) and removed from subsequent route evaluation. This is the default behavior.copy: Matched data is copied to the target pipeline(s) but remains available for evaluation by subsequent routes. This allows the same data to be routed to multiple pipelines.
table.pipelines (required): the list of pipelines to use when the routing condition is met.default_pipelines (optional): contains the list of pipelines to use when a record does not meet any of specified conditions.error_mode (optional): determines how errors returned from OTTL statements are handled. Valid values arepropagate,ignoreandsilent. Ifignoreorsilentis used and a statement’s condition has an error then the payload will be routed to the default pipelines. Whensilentis used the error is not logged. If not supplied,propagateis used.
Limitations
- The
requestcontext requires use of theconditionsetting, and relies on a very limited grammar. Conditions must be in the form ofrequest["key"] == "value"orrequest["key"] != "value". (In the future, this grammar may be expanded to support more complex conditions.)
Supported OTTL functions
Additional Settings
The full list of settings exposed for this connector are documented in config.go with detailed sample configuration files:Examples
Route logs based on tenant:action: copy:
- All logs are first copied to the archive pipeline (using
action: copy), which means the original data remains available for subsequent route evaluation. - Error logs are then moved to the errors pipeline (using the default
action: move). - Any remaining logs (non-errors) go to the default pipeline.
action: copy:
- Production traces are copied to the prod pipeline. Since
action: copyis used, the traces remain available for subsequent evaluation. - High-latency spans (>1000ms) are then moved to the high-latency pipeline. A production trace with high latency will appear in both the prod and high-latency pipelines.
- Remaining traces go to the default pipeline.
match_once
The match_once field was deprecated as of v0.116.0 and removed in v0.120.0.
The following examples demonstrate some strategies for migrating a configuration from match_once.
Example without default_pipelines
If not using default_pipelines, you may be able to split the router into multiple parallel routers.
In the following example, the "env" and "region" are not directly related.
Example with default_pipelines
The following example demonstrates strategies for migrating from match_once: true while using default_pipelines.
default_pipelines. The downside to this approach is that the set of conditions
in the first and second layers must be kept in sync.
Last generated: 2026-06-01