OpenObserve Docs
ReferenceApiIngestionLogs

Logs Ingestion - OTLP

Endpoint: POST /api/{organization}/v1/logs

OpenObserve supports the OpenTelemetry Protocol (OTLP) for log ingestion. You can send logs from any OpenTelemetry-compatible collector or SDK by pointing it at OpenObserve.

we use custom http header stream-name for speciafic stream name, default will push into default stream.

Request

e.g. POST /api/myorg/v1/logs

Content-Type: application/json (JSON) or application/x-protobuf (Protobuf)

{
  "resourceLogs": [
    {
      "resource": {
        "attributes": [
          {
            "key": "service.name",
            "value": { "stringValue": "my-service" }
          },
          {
            "key": "service.version",
            "value": { "stringValue": "1.2.3" }
          },
          {
            "key": "host.name",
            "value": { "stringValue": "ip-10-2-50-35.us-east-2.compute.internal" }
          }
        ]
      },
      "scopeLogs": [
        {
          "scope": {
            "name": "my-logger",
            "version": "1.0.0"
          },
          "logRecords": [
            {
              "timeUnixNano": "1672149599212000000",
              "observedTimeUnixNano": "1672149599212000000",
              "severityNumber": 9,
              "severityText": "INFO",
              "body": {
                "stringValue": "Request processed successfully"
              },
              "attributes": [
                {
                  "key": "http.method",
                  "value": { "stringValue": "GET" }
                },
                {
                  "key": "http.status_code",
                  "value": { "intValue": "200" }
                },
                {
                  "key": "trace_id",
                  "value": { "stringValue": "4bf92f3577b34da6a3ce929d0e0e4736" }
                }
              ],
              "traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
              "spanId": "00f067aa0ba902b7"
            }
          ]
        }
      ]
    }
  ]
}

Fields

FieldTypeDescription
resourceLogsarrayList of resource log groups.
resourceLogs[].resourceobjectResource describing the entity producing the logs (e.g. service, host).
resourceLogs[].resource.attributesarrayKey-value pairs for resource-level metadata.
resourceLogs[].scopeLogsarrayList of instrumentation scope log groups.
scopeLogs[].scopeobjectInstrumentation scope (library name and version).
scopeLogs[].logRecordsarrayList of individual log records.
logRecords[].timeUnixNanostringLog timestamp in nanoseconds since Unix epoch.
logRecords[].observedTimeUnixNanostringTime the log was observed by the collector, in nanoseconds.
logRecords[].severityNumberintegerNumeric severity level (1–24). See OTLP severity levels.
logRecords[].severityTextstringHuman-readable severity string (e.g. INFO, WARN, ERROR).
logRecords[].bodyobjectLog message body. Typically a stringValue.
logRecords[].attributesarrayKey-value pairs for log-level metadata.
logRecords[].traceIdstringTrace ID associated with this log record (hex string).
logRecords[].spanIdstringSpan ID associated with this log record (hex string).

Response

{
  "partialSuccess": {}
}

HTTP status 200 OK with an empty partialSuccess object indicates all records were accepted, matching the standard OTLP HTTP response format.

Authentication

Pass your credentials using HTTP Basic Auth or via the Authorization header:

Authorization: Basic <base64(user:password)>

Configuring OpenTelemetry Collector

Configure the OTLP exporter in your OpenTelemetry Collector config.yaml to forward logs to OpenObserve:

exporters:
  otlphttp/openobserve:
    endpoint: https://<openobserve-host>/api/<organization>
    headers:
      Authorization: "Basic <base64(user:password)>"
      stream-name: "custom_stream"

service:
  pipelines:
    logs:
      receivers: [...]
      processors: [...]
      exporters: [otlphttp/openobserve]
Was this page helpful?

Last updated on

On this page