OpenTelemetry Collector
Learn how to set up the OpenTelemetry Collector to forward logs and traces data to Sentry.
The OpenTelemetry Collector is a vendor-agnostic proxy that can receive, process, and export telemetry data. You can configure the Collector to forward logs and traces to Sentry using the otlphttp exporter.
If you're looking to forward logs and traces from an OpenTelemetry SDK directly to Sentry, take a look at our OpenTelemetry (OTLP) documentation instead.
Before you begin, ensure you have:
- OpenTelemetry Collector installed and running
- A Sentry project you want to send data to
You'll need your Sentry OTLP endpoint and authentication header. These can be found in your Sentry Project Settings under Client Keys (DSN) > OpenTelemetry (OTLP).
___OTLP_LOGS_URL___
___OTLP_TRACES_URL___
When configuring a combined pipeline, use the base OTLP endpoint. The OpenTelemetry Collector will automatically append the appropriate path (/v1/logs or /v1/traces) based on the signal type.
___OTLP_URL___
x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___
Update your OpenTelemetry Collector configuration to add the otlphttp exporter pointing to Sentry. You can configure logs, traces, or both.
To forward logs to Sentry, add the following exporter configuration:
otel-collector.yamlexporters:
otlphttp/sentry:
logs_endpoint: ___OTLP_LOGS_URL___
headers:
x-sentry-auth: "sentry sentry_key=___PUBLIC_KEY___"
compression: gzip
encoding: proto
To forward traces to Sentry, add the following exporter configuration:
otel-collector.yamlexporters:
otlphttp/sentry:
traces_endpoint: ___OTLP_TRACES_URL___
headers:
x-sentry-auth: "sentry sentry_key=___PUBLIC_KEY___"
compression: gzip
encoding: proto
To send both logs and traces to Sentry, you can combine the configurations:
otel-collector.yamlexporters:
otlphttp/sentry:
endpoint: ___OTLP_URL___
headers:
x-sentry-auth: "sentry sentry_key=___PUBLIC_KEY___"
compression: gzip
encoding: proto
Sentry's OTLP endpoints are project-specific. If you need to route telemetry from different services to different Sentry projects, you can use the routing connector.
otel-collector.yamlreceivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
connectors:
routing:
default_pipelines: [logs/project-a]
error_mode: ignore
table:
- statement: route() where attributes["service.name"] == "service-b"
pipelines: [logs/project-b]
exporters:
otlphttp/project-a:
logs_endpoint: https://o00000.ingest.sentry.io/api/1111111/integration/otlp/v1/logs
headers:
x-sentry-auth: "sentry sentry_key=example-public-key-for-project-a"
compression: gzip
encoding: proto
otlphttp/project-b:
logs_endpoint: https://o00000.ingest.sentry.io/api/2222222/integration/otlp/v1/logs
headers:
x-sentry-auth: "sentry sentry_key=example-public-key-for-project-b"
compression: gzip
encoding: proto
service:
pipelines:
logs:
receivers: [otlp]
exporters: [routing]
logs/project-a:
receivers: [routing]
exporters: [otlphttp/project-a]
logs/project-b:
receivers: [routing]
exporters: [otlphttp/project-b]
These guides show you how to leverage the OpenTelemetry Collector to send traces and logs to Sentry from different sources.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").