Skip to main content

OpenTelemetry

If your application already sends its logs with OpenTelemetry, it can send them to Collector without installing any Collector package, over OTLP/HTTP. Logs only: traces and metrics keep going where they go now.

Setting up the exporter​

Create a server key in the project's settings and use OpenTelemetry's logs-only variables:

OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://app.clt.chrom.ar/otlp/v1/logs
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_LOGS_HEADERS=Authorization=Bearer%20clts_…

Write the space after Bearer as %20: that's how OpenTelemetry reads headers from environment variables. Protobuf and JSON are both accepted, gzipped or not.

If your logs go through an OpenTelemetry Collector, add Collector as one more otlphttp exporter of its logs pipeline, with the same endpoint and header. The project's Setup shows the full configuration in its OpenTelemetry tab.

How each record shows​

Every OpenTelemetry record becomes a log line in Logs:

Field in CollectorWhere it comes from
TimetimeUnixNano, else observedTimeUnixNano, else when received
LevelseverityNumber: 1–8 debug, 9–12 info, 13–16 warning, 17–20 error, 21–24 critical. Without it, severityText; else info
MessageThe body (non-strings as JSON)
LoggerThe instrumentation scope's name
ServiceResource service.name
Environmentdeployment.environment.name, else deployment.environment
Releaseservice.version
Serverhost.name, else service.instance.id
RequestThe traceId: a trace's lines group like a request's
UserAttribute user.id, else enduser.id
MetadataThe record's attributes, the resource's not used above, and span_id

Name the service and the environment (OTEL_RESOURCE_ATTRIBUTES=service.name=api,deployment.environment.name=production) to be able to filter by them.

Limits​

The same server key and the same log-line budget as the SDKs. Up to 10,000 records and 10 MB per request. Records more than 7 days back or more than an hour ahead are rejected. If the project went over its budget, Collector answers 429 and the exporter retries on its own. See Limits.