Migrate from Elastic to Logfire
Elastic’s observability is fed by OTLP, either through the Elastic Distributions of OpenTelemetry (EDOT — Elastic’s Collector and SDK distributions) or by pointing OTel SDKs at the Elastic Cloud Managed OTLP Endpoint (mOTLP). Authentication uses an Authorization: ApiKey <key> header. Because it’s standard OpenTelemetry, migrating to Logfire is an exporter change — see Migrate to Logfire for the general shape.
You’ll need a Logfire write token and your region endpoint (https://logfire-us.pydantic.dev or -eu).
Point the SDK at Logfire and replace Elastic’s API key header with Logfire’s write token:
# before (Elastic — copy your Managed OTLP Endpoint from Elastic Cloud; the
# API key from Kibana does not include the "ApiKey " scheme, so add it yourself):
# OTEL_EXPORTER_OTLP_ENDPOINT=https://<your-managed-otlp-endpoint>
# OTEL_EXPORTER_OTLP_HEADERS='Authorization=ApiKey your-elastic-api-key'
export OTEL_EXPORTER_OTLP_ENDPOINT=https://logfire-us.pydantic.dev
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_HEADERS='Authorization=your-write-token'
export OTEL_SERVICE_NAME=your-service-name
Change the exporter’s endpoint and header to Logfire’s:
exporters:
otlphttp/logfire:
endpoint: "https://logfire-us.pydantic.dev" # or https://logfire-eu.pydantic.dev
headers:
# was: Authorization: "ApiKey your-elastic-api-key"
Authorization: "Bearer ${env:LOGFIRE_TOKEN}"
service:
pipelines:
traces:
exporters: [otlphttp/logfire]
metrics:
exporters: [otlphttp/logfire]
logs:
exporters: [otlphttp/logfire]
Keep both exporters in the pipeline to run in parallel during a cutover.
Run your workload and open the Live view. Traces should appear within seconds.
- Migrate to Logfire — the general two-path pattern and parallel-run guidance
- Alternative clients — worked SDK examples
- Elastic’s own docs, to confirm your current endpoint and header: Elastic Cloud Managed OTLP Endpoint