This page is not yet available in Spanish. We are working on its translation. If you have any questions or feedback about our current translation project, feel free to reach out to us!
The Datadog OTLP logs intake endpoint is in Preview.
Datadog OTLP logs intake endpoint is not supported for your selected Datadog site (US1).
To send OTLP data to the Datadog OTLP logs intake endpoint, you must configure the OTLP HTTP Protobuf exporter. The process differs depending on whether you are using automatic or manual instrumentation for OpenTelemetry.
Based on your Datadog site, which is US1: Replace ${YOUR_ENDPOINT} with https://http-intake.logs.datadoghq.com/api/v2/logs in the following examples.
exportOTEL_EXPORTER_OTLP_LOGS_PROTOCOL="http/protobuf"exportOTEL_EXPORTER_OTLP_LOGS_ENDPOINT="${YOUR_ENDPOINT}" // Replace this with the correct endpoint
exportOTEL_EXPORTER_OTLP_LOGS_HEADERS="dd-protocol=otlp,dd-api-key=${DD_API_KEY}"
If you are using manual instrumentation with OpenTelemetry SDKs, configure the OTLP HTTP Protobuf exporter programmatically using the following examples.
OpenTelemetry SDK logs support for JavaScript and Python is in development. For the latest statuses, see OpenTelemetry Status and Releases.
The Java exporter is OtlpHttpLogRecordExporter. To configure the exporter, use the following code snippet:
importio.opentelemetry.exporter.otlp.http.logs.OtlpHttpLogRecordExporter;OtlpHttpLogRecordExporterexporter=OtlpHttpLogRecordExporter.builder().setEndpoint("${YOUR_ENDPOINT}")// Replace this with the correct endpoint.addHeader("dd-protocol","otlp").addHeader("dd-api-key",System.getenv("DD_API_KEY")).build();
The Go exporter is otlploghttp. To configure the exporter, use the following code snippet:
import"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"logExporter,err:=otlploghttp.New(ctx,otlploghttp.WithEndpointURL("${YOUR_ENDPOINT}"),// Replace this with the correct endpoint, minus the URL path
otlploghttp.WithURLPath("/api/v2/logs"),otlploghttp.WithHeaders(map[string]string{"dd-protocol":"otlp","dd-api-key":os.Getenv("DD_API_KEY"),}),)
If you are using the OpenTelemetry Collector and don’t want to use the Datadog Exporter, you can configure otlphttpexporter to export logs to the Datadog OTLP logs intake endpoint.
Configure your config.yaml like this:
exporters:otlphttp:logs_endpoint:${YOUR_ENDPOINT} // Replace this with the correct endpointheaders:dd-protocol:"otlp"dd-api-key:${env:DD_API_KEY}service:pipelines:logs:receivers:[otlp]processors:[batch]exporters:[otlphttp]
If you receive a 403 Forbidden error when sending logs to the Datadog OTLP logs intake endpoint, it indicates one of the following issues:
The API key belongs to an organization that is not allowed to access the Datadog OTLP logs intake endpoint. Solution: Verify that you are using a valid API key with appropriate permissions.
The endpoint URL is incorrect for your organization. Solution: Use the correct endpoint URL for your organization. Your site is US1, so you need to use the https://http-intake.logs.datadoghq.com/api/v2/logs endpoint.