Documentation menu
SDKs

OpenTelemetry

Send logs to Incidion over OTLP/HTTP from the OpenTelemetry Collector or any OpenTelemetry SDK.

Incidion accepts OpenTelemetry logs over OTLP/HTTP, as protobuf or JSON. Any OpenTelemetry SDK or the OpenTelemetry Collector can send logs straight to the ingest service, so every language with OpenTelemetry support works without an Incidion SDK.

Only logs are ingested. Traces and metrics sent over OTLP are not accepted: there is no /v1/traces or /v1/metrics OTLP endpoint, and OTLP over gRPC is not supported. The trace_id and span_id of each log record are kept, so logs stay linked to traces you store elsewhere. For server metrics use an Incidion SDK or the metrics API.

Endpoint

POST https://ingest.incidion.dev/v1/otlp/v1/logs

https://ingest.incidion.dev/otlp/v1/logs is an alias for exporters that append /v1/logs to a base URL (base https://ingest.incidion.dev/otlp).

Header Value
X-API-Key The project’s public key, pk_... (or Authorization: Bearer pk_...)
Content-Type application/x-protobuf (OTLP protobuf) or application/json (OTLP JSON)
Content-Encoding optional, gzip
X-Environment-Id optional, the UUID of an Incidion environment; otherwise the key’s environment

Only pk_ keys are accepted; a secret sk_ key gets 401. Create keys in Settings > API Keys (API Keys).

Test it with curl and OTLP JSON:

curl -X POST https://ingest.incidion.dev/v1/otlp/v1/logs \
  -H "X-API-Key: pk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "resourceLogs": [{
      "resource": {"attributes": [{"key": "service.name", "value": {"stringValue": "checkout"}}]},
      "scopeLogs": [{
        "scope": {"name": "orders"},
        "logRecords": [{
          "severityNumber": 17,
          "severityText": "ERROR",
          "body": {"stringValue": "Payment failed"},
          "attributes": [{"key": "order_id", "value": {"stringValue": "o-981"}}],
          "traceId": "5b8efff798038103d269b633813fc60c",
          "spanId": "eee19b7ec3c1b174"
        }]
      }]
    }]
  }'

The answer is 200 with an OTLP response in the request’s format ({} for JSON when everything was stored). When single records are rejected, the rest is stored and the answer carries partialSuccess with rejectedLogRecords and errorMessage (the reasons of the first five). Without timeUnixNano the record gets the time it was received. An X-Environment-Id that is not a UUID gets 422.

Attribute mapping

OTLP Incidion
resource service.name service
resource telemetry.sdk.name / telemetry.sdk.version sdk_name / sdk_version
other resource attributes attributes.resource
scope name logger
severityNumber 1-8 / 9-12 / 13-16 / 17-20 / 21-24 debug / info / warning / error / critical
severityText (when there is no number) level by name, default info
body string message
body map message from its message, msg or log field, the rest in attributes.body (level from its level or severity when no severity is set); without such a field the whole map as JSON
attributes attributes
traceId / spanId trace_id / span_id, and attributes.trace_id / attributes.span_id (hex)
timeUnixNano (else observedTimeUnixNano, else now) timestamp
exception.type / exception.message / exception.stacktrace error_type / error_message / stack_trace
code.filepath (code.file.path), code.lineno (code.line.number), code.function (code.function.name) file_name, line_number, function_name
http.request.method, url.path, http.response.status_code, user_agent.original, client.address, enduser.id, session.id (and their older names http.method, http.target, http.status_code, http.user_agent, user.id) http_method, http_path, http_status, user_agent, ip_address, user_id, session_id

Attributes copied into a column are removed from attributes. Everything else stays searchable under attributes.

Limits

Limit Value Over it
Request body on the wire 5 MiB 413
Body after gzip decompression 10 MiB 413
Log records (and resource or scope entries) per request 10,000 413
One record, resource or scope (protobuf) 1 MiB that record rejected in partialSuccess
Attribute values per request 1,000,000 413
Log lines per day per plan (Free 100,000, Pro 2,000,000, Business 10,000,000) 429, Retry-After until 00:00 UTC
Requests per minute per key (default 1,000, adjustable within the plan) 429, Retry-After

429 and 503 carry Retry-After, and the Collector and the SDK exporters retry them on their own. 400 (a broken body) and 415 (another Content-Type) are not retried. A record that does not decode, typically a string that is not valid UTF-8, is rejected on its own and the rest of the export is stored. Log retention follows the plan: see Plans and Limits.

OpenTelemetry Collector

Use the otlphttp exporter with logs_endpoint, which is used exactly as given:

receivers:
  otlp:
    protocols:
      grpc:
      http:

processors:
  batch:
    send_batch_size: 1000
    send_batch_max_size: 5000   # stay below 10,000 records per request
    timeout: 5s

exporters:
  otlphttp/incidion:
    logs_endpoint: https://ingest.incidion.dev/v1/otlp/v1/logs
    headers:
      X-API-Key: ${env:INCIDION_API_KEY}
      # X-Environment-Id: 3f2c9a7e-0000-4000-8000-000000000000
    compression: gzip
    encoding: proto
    retry_on_failure:
      enabled: true
    sending_queue:
      enabled: true

service:
  pipelines:
    logs:
      receivers: [otlp]
      processors: [batch]
      exporters: [otlphttp/incidion]

Applications keep sending OTLP to the Collector (gRPC on 4317 or HTTP on 4318); the Collector forwards the logs to Incidion. Traces and metrics need pipelines with other exporters; do not add otlphttp/incidion to them.

Tail log files

The filelog receiver (in the otelcol-contrib distribution) reads files. For JSON lines, parse each line into the body: Incidion then takes the message from its message, msg or log field, the level from level or severity, and keeps the other fields in attributes.body.

receivers:
  filelog:
    include: [/var/log/myapp/*.log]
    start_at: end
    operators:
      - type: json_parser
        parse_to: body

processors:
  resource/myapp:
    attributes:
      - key: service.name
        value: myapp
        action: upsert
  batch:
    send_batch_max_size: 5000

exporters:
  otlphttp/incidion:
    logs_endpoint: https://ingest.incidion.dev/v1/otlp/v1/logs
    headers:
      X-API-Key: ${env:INCIDION_API_KEY}
    compression: gzip

service:
  pipelines:
    logs:
      receivers: [filelog]
      processors: [resource/myapp, batch]
      exporters: [otlphttp/incidion]

Plain text lines arrive as the message at level info; add a regex_parser with a severity block to set the level. Check the file with otelcol-contrib validate --config=config.yaml before rolling it out.

Environment variables (any SDK)

Most OpenTelemetry SDKs and agents read the standard variables. The signal-specific endpoint is used as-is:

OTEL_SERVICE_NAME=checkout
OTEL_LOGS_EXPORTER=otlp
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://ingest.incidion.dev/v1/otlp/v1/logs
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_LOGS_HEADERS=x-api-key=pk_your_key
# Incidion ingests logs only: turn the other exporters off, or point them elsewhere
OTEL_TRACES_EXPORTER=none
OTEL_METRICS_EXPORTER=none

Header values in OTEL_EXPORTER_OTLP_LOGS_HEADERS are URL-encoded, so x-api-key=... is simpler than Authorization=Bearer%20pk_.... Add ,x-environment-id=<uuid> to pick an environment. OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/json works too; grpc does not.

Node.js

npm install @opentelemetry/api-logs @opentelemetry/sdk-logs @opentelemetry/exporter-logs-otlp-http @opentelemetry/resources
import { logs, SeverityNumber } from '@opentelemetry/api-logs';
import { LoggerProvider, BatchLogRecordProcessor } from '@opentelemetry/sdk-logs';
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http';
import { resourceFromAttributes } from '@opentelemetry/resources';

const exporter = new OTLPLogExporter({
  url: 'https://ingest.incidion.dev/v1/otlp/v1/logs',
  headers: { 'X-API-Key': process.env.INCIDION_API_KEY! },
});

const provider = new LoggerProvider({
  resource: resourceFromAttributes({ 'service.name': 'checkout' }),
  processors: [new BatchLogRecordProcessor(exporter)],
});
logs.setGlobalLoggerProvider(provider);

const logger = logs.getLogger('orders');
logger.emit({
  severityNumber: SeverityNumber.ERROR,
  severityText: 'ERROR',
  body: 'Payment failed',
  attributes: { order_id: 'o-981' },
});

process.on('SIGTERM', () => provider.shutdown()); // flushes queued records

@opentelemetry/exporter-logs-otlp-http sends OTLP JSON; @opentelemetry/exporter-logs-otlp-proto (same options) sends protobuf. The processors option is for @opentelemetry/sdk-logs 0.200 and newer; older versions call provider.addLogRecordProcessor(...). With @opentelemetry/sdk-node, the environment variables above configure the logs exporter, and the pino and winston instrumentations can forward your existing logger’s records. In Node.js you can also use the JavaScript SDK.

Python

pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
import logging
import os

from opentelemetry._logs import set_logger_provider
from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter
from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler
from opentelemetry.sdk._logs.export import BatchLogRecordProcessor
from opentelemetry.sdk.resources import Resource

provider = LoggerProvider(resource=Resource.create({"service.name": "checkout"}))
provider.add_log_record_processor(
    BatchLogRecordProcessor(
        OTLPLogExporter(
            endpoint="https://ingest.incidion.dev/v1/otlp/v1/logs",
            headers={"X-API-Key": os.environ["INCIDION_API_KEY"]},
        )
    )
)
set_logger_provider(provider)

# Send standard logging records through OpenTelemetry
logging.getLogger().addHandler(LoggingHandler(level=logging.INFO, logger_provider=provider))

logging.getLogger("orders").error("Payment failed", extra={"order_id": "o-981"})
provider.shutdown()  # at exit: flushes queued records

The logs modules are still underscore-prefixed (_logs) in Python, meaning their API can change; check the names against the version you install. With zero-code instrumentation (opentelemetry-instrument), set the environment variables above plus OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true; the protocol variable matters there, because the default is gRPC. Or use the Python SDK.

Java

The OpenTelemetry Java agent captures Logback, Log4j and java.util.logging records without code changes:

export OTEL_SERVICE_NAME=checkout
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://ingest.incidion.dev/v1/otlp/v1/logs
export OTEL_EXPORTER_OTLP_LOGS_HEADERS=x-api-key=pk_your_key
export OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/protobuf
export OTEL_TRACES_EXPORTER=none
export OTEL_METRICS_EXPORTER=none

java -javaagent:opentelemetry-javaagent.jar -jar app.jar

The same settings work as system properties (-Dotel.exporter.otlp.logs.endpoint=...). Exceptions logged with a throwable arrive with error_type, error_message and stack_trace.

.NET

dotnet add package OpenTelemetry.Extensions.Hosting
dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol
using OpenTelemetry.Exporter;
using OpenTelemetry.Logs;
using OpenTelemetry.Resources;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddOpenTelemetry()
    .ConfigureResource(resource => resource.AddService("checkout"))
    .WithLogging(
        logging => logging.AddOtlpExporter(otlp =>
        {
            otlp.Endpoint = new Uri("https://ingest.incidion.dev/v1/otlp/v1/logs");
            otlp.Protocol = OtlpExportProtocol.HttpProtobuf;
            otlp.Headers = $"X-API-Key={builder.Configuration["INCIDION_API_KEY"]}";
        }),
        options =>
        {
            options.IncludeFormattedMessage = true; // the rendered message, not the template
            options.IncludeScopes = true;
        });

var app = builder.Build();

Every ILogger call is then exported. With HttpProtobuf, an endpoint set in code is used exactly as given. The OTEL_EXPORTER_OTLP_LOGS_* variables above work as well.

Go

go get go.opentelemetry.io/otel/sdk/log go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp go.opentelemetry.io/contrib/bridges/otelslog
package main

import (
	"context"
	"log"
	"os"

	"go.opentelemetry.io/contrib/bridges/otelslog"
	"go.opentelemetry.io/otel/attribute"
	"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"
	sdklog "go.opentelemetry.io/otel/sdk/log"
	"go.opentelemetry.io/otel/sdk/resource"
)

func main() {
	ctx := context.Background()

	exporter, err := otlploghttp.New(ctx,
		otlploghttp.WithEndpointURL("https://ingest.incidion.dev/v1/otlp/v1/logs"),
		otlploghttp.WithHeaders(map[string]string{"X-API-Key": os.Getenv("INCIDION_API_KEY")}),
	)
	if err != nil {
		log.Fatal(err)
	}
	provider := sdklog.NewLoggerProvider(
		sdklog.WithResource(resource.NewSchemaless(attribute.String("service.name", "checkout"))),
		sdklog.WithProcessor(sdklog.NewBatchProcessor(exporter)),
	)
	defer provider.Shutdown(ctx) // flushes queued records

	logger := otelslog.NewLogger("orders", otelslog.WithLoggerProvider(provider))
	logger.ErrorContext(ctx, "payment failed", "order_id", "o-981")
}

The Go logs SDK and the otelslog bridge are not yet stable (their API can still change). The Go SDK has its own slog handler and needs neither.

Ruby, PHP and Rust

These SDKs export OTLP logs over HTTP/protobuf, but their logs support is younger than for the languages above; check the OpenTelemetry docs for the version you use, or run the Collector and send to it.

Ruby (experimental): the opentelemetry-logs-sdk and opentelemetry-exporter-otlp-logs gems, configured with OpenTelemetry::SDK.configure and the environment variables above. The opentelemetry-instrumentation-logger gem forwards Ruby Logger output.

PHP: open-telemetry/sdk and open-telemetry/exporter-otlp (plus a PSR-18 HTTP client), with autoloading turned on; open-telemetry/opentelemetry-logger-monolog forwards Monolog records.

OTEL_PHP_AUTOLOAD_ENABLED=true
OTEL_SERVICE_NAME=checkout
OTEL_LOGS_EXPORTER=otlp
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://ingest.incidion.dev/v1/otlp/v1/logs
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_LOGS_HEADERS=x-api-key=pk_your_key
OTEL_TRACES_EXPORTER=none
OTEL_METRICS_EXPORTER=none

Rust: the opentelemetry-otlp crate (features logs and http-proto) with opentelemetry-appender-tracing or opentelemetry-appender-log as the bridge. The crates are pre-1.0 and their builder API changes between versions; in recent versions:

use opentelemetry_otlp::{LogExporter, Protocol, WithExportConfig, WithHttpConfig};

let exporter = LogExporter::builder()
    .with_http()
    .with_protocol(Protocol::HttpBinary)
    .with_endpoint("https://ingest.incidion.dev/v1/otlp/v1/logs")
    .with_headers([("X-API-Key".to_string(), std::env::var("INCIDION_API_KEY")?)].into())
    .build()?;

Troubleshooting

401. The key is missing, wrong, disabled or a secret sk_ key. OTLP needs the public pk_ key. Check that the header actually reaches the request: in OTEL_EXPORTER_OTLP_LOGS_HEADERS it is x-api-key=pk_..., without quotes or spaces.

404. The exporter appended a path. Use the signal-specific setting (OTEL_EXPORTER_OTLP_LOGS_ENDPOINT, logs_endpoint, the exporter’s url or endpoint) with the full URL, or set the base endpoint to https://ingest.incidion.dev/otlp so the appended /v1/logs lands on the alias. Traces and metrics sent to Incidion also get 404: turn those exporters off.

415. The exporter uses gRPC or another content type. Set the protocol to http/protobuf or http/json.

413. The export is too large. Lower the batch size (Collector: send_batch_max_size below 10,000).

Records arrive as JSON text. The body was a map without a message, msg or log field. Name the message field that way, or parse the line into attributes instead of the body.