OpenTelemetry
Send logs via OTLP/HTTP using any OpenTelemetry-compatible SDK or collector.
OTLP endpoint
text
POST https://api.getlogflow.com/v1/otlp/v1/logs
Content-Type: application/json
Authorization: Bearer lf_YOUR_API_KEYℹ️
LogFlow accepts OTLP/HTTP JSON format. The
service.nameresource attribute is used as the log's service field.Node.js with @opentelemetry/sdk-node
bash
npm install @opentelemetry/sdk-node @opentelemetry/exporter-logs-otlp-httptypescript
import { NodeSDK } from '@opentelemetry/sdk-node'
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http'
import { Resource } from '@opentelemetry/resources'
const sdk = new NodeSDK({
resource: new Resource({ 'service.name': 'my-api' }),
logRecordExporter: new OTLPLogExporter({
url: 'https://api.getlogflow.com/v1/otlp/v1/logs',
headers: { Authorization: 'Bearer lf_YOUR_API_KEY' },
}),
})
sdk.start()OpenTelemetry Collector
yaml
# otel-collector-config.yaml
exporters:
otlphttp/logflow:
endpoint: https://api.getlogflow.com/v1/otlp
headers:
Authorization: "Bearer lf_YOUR_API_KEY"
service:
pipelines:
logs:
exporters: [otlphttp/logflow]Trace propagation
When using OpenTelemetry tracing, traceId and spanId are automatically extracted from the active span context and attached to each log. This powers the Service Map and trace correlation features.
Field mapping
- OTel
severityText→ LogFlowlevel - OTel
body→ LogFlowmessage - OTel
resource.service.name→ LogFlowservice - OTel
traceId/spanId→ LogFlow trace fields - OTel attributes → LogFlow
attributesmap