Documentation menu
Logs

Send Logs

Ingest logs from your application to Incidion.

Send logs from your application to Incidion for centralized log aggregation, search, and analysis. Logs are stored in ClickHouse and kept as long as your plan allows.

Authentication

Logs are sent with the project’s public API key (pk_...) in the X-API-Key header or as Authorization: Bearer pk_.... Secret keys (sk_...) are refused by the ingest service.

X-API-Key: pk_your_public_key

Create API keys in Settings > API keys (owners and admins). Every /v1/... request answers 401 without a valid, active pk_ key.

Or use an SDK: see SDKs.

Batch ingestion

Send multiple logs at once for efficiency:

curl -X POST https://ingest.incidion.dev/v1/logs \
  -H "X-API-Key: pk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "logs": [
      {
        "timestamp": "2026-10-05T12:00:00Z",
        "level": "info",
        "message": "Request processed",
        "service": "api",
        "attributes": {
          "user_id": "123",
          "duration_ms": 42
        }
      },
      {
        "timestamp": "2026-10-05T12:00:01Z",
        "level": "error",
        "message": "Database timeout",
        "service": "api",
        "attributes": {
          "query": "SELECT * FROM large_table",
          "duration_ms": 5000
        }
      }
    ]
  }'

Response:

{"accepted": 2, "rejected": 0, "errors": [], "message": "ok"}

Rows that fail validation are rejected one by one and listed in errors (at most 100); the others are stored and the answer is 200 with "message": "Some logs were rejected". When every row is rejected the answer is 422:

{"accepted": 1, "rejected": 1, "errors": [{"index": 1, "error": "level: level must be one of debug, info, warning, error, critical"}], "message": "Some logs were rejected"}

A timestamp older than your plan’s retention (7 days on Free) or more than a day in the future rejects that row; without a timestamp the row gets the time it arrived. Add "environment_id" (a UUID) next to "logs" to file the batch under an environment; otherwise the key’s environment is used.

Limits per request: 5 MiB on the wire, 10 MiB after decompression (Content-Encoding: gzip or deflate), 10,000 rows. Larger requests get 413: split them. A body that is not a JSON object with a logs list gets 422.

Single log

For simple cases or testing:

curl -X POST https://ingest.incidion.dev/v1/logs/single \
  -H "X-API-Key: pk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "level": "error",
    "message": "Payment failed",
    "service": "payments"
  }'

Log fields

Field Type Required Example
timestamp ISO 8601 (without an offset: UTC) No 2026-10-05T12:00:00Z
level string No (default info) debug, info, warning, error, critical
message string Yes "User login successful"
service string No "api", "worker", "cron"
attributes object No {"user_id": "123"}
logger string No "com.example.AuthService"
file_name string No "auth.py"
line_number int No 42
function_name string No "authenticate"
request_id string No "req-abc123"
trace_id string No "trace-xyz789"
span_id string No "span-123"
user_id string No "user-456"
session_id string No "sess-789"
http_method string No "POST"
http_path string No "/api/login"
http_status int No 200
http_duration_ms int No 42
ip_address string No "192.168.1.1"
user_agent string No "Mozilla/5.0..."
error_type string No "TimeoutError"
error_message string No "Connection timeout"
stack_trace string No "at main:42..."
sdk_name string No "incidion-python"
sdk_version string No "1.2.3"

Unknown fields are ignored. service, logger, the ids and sdk_* hold up to 256 characters, http_method 16 and ip_address 64; longer values reject the row. Numbers and booleans sent for text fields are stored as text.

Python example

from datetime import datetime, timezone

import requests

api_key = "pk_your_key"
ingest_url = "https://ingest.incidion.dev/v1/logs"

logs = [
    {
        "timestamp": datetime.now(timezone.utc).isoformat(),
        "level": "error",
        "message": "Database connection failed",
        "service": "api",
        "attributes": {
            "host": "db.example.com",
            "port": 5432
        },
        "error_type": "psycopg2.OperationalError",
        "error_message": "could not translate host name"
    }
]

response = requests.post(
    ingest_url,
    headers={"X-API-Key": api_key},
    json={"logs": logs},
    timeout=10,
)

print(response.json())

Node.js example

// npm install axios
const axios = require('axios');

const apiKey = 'pk_your_key';
const ingestUrl = 'https://ingest.incidion.dev/v1/logs';

const logs = [
  {
    timestamp: new Date().toISOString(),
    level: 'warn',
    message: 'Memory usage high',
    service: 'worker',
    attributes: {
      memory_mb: 512,
      threshold_mb: 400
    }
  }
];

axios.post(ingestUrl, { logs }, {
  headers: { 'X-API-Key': apiKey }
}).then(res => {
  console.log(`Sent ${res.data.accepted} logs`);
}).catch(err => {
  console.error('Failed to send logs:', err);
});

Bash example (curl)

#!/bin/bash
API_KEY="pk_your_key"
INGEST_URL="https://ingest.incidion.dev/v1/logs"

log_error() {
  local message=$1
  
  curl -s -X POST "$INGEST_URL" \
    -H "X-API-Key: $API_KEY" \
    -H "Content-Type: application/json" \
    -d @- <<EOF
{
  "logs": [
    {
      "timestamp": "$(date -u +'%Y-%m-%dT%H:%M:%SZ')",
      "level": "error",
      "message": "$message",
      "service": "bash-script"
    }
  ]
}
EOF
}

# Usage
log_error "Backup failed: disk space exceeded"

Performance tips

  • Batch logs: Send multiple logs in one request (more efficient)
  • Async sending: Don’t block your app waiting for log delivery
  • Retry on failure: Implement exponential backoff
  • Buffer locally: If ingest is unreachable, buffer logs and retry
  • Compression: For large batches, send gzip (Content-Encoding: gzip)

Batch size recommendations

  • Small app: 10-50 logs per batch
  • Medium app: 50-200 logs per batch
  • Large app: 200-1000 logs per batch

A request may carry up to 10,000 rows. Larger batches are more efficient; test and tune for your use case.

Log levels

Standard log levels:

  • debug: Detailed diagnostic info
  • info: General informational message
  • warning: Warning condition, potential issue
  • error: Error condition that should be addressed
  • critical: Critical error, immediate action needed

Common other names are mapped (case-insensitive): trace, verbose, dbg → debug; information, notice → info; warn → warning; err → error; fatal, crit, alert, emerg, panic → critical. Any other level rejects the row. In Logs, filter by level to find errors quickly.

Structured logging

Use attributes for structured data:

{
  "message": "User signup",
  "service": "auth",
  "attributes": {
    "user_id": "123",
    "email": "user@example.com",
    "signup_method": "email",
    "success": true
  }
}

Attributes are stored as JSON and shown with each log line. Search matches the message text only, so put what you want to find (ids, emails) into the message too, or use the dedicated fields such as user_id and request_id, which Logs can filter on.

Request/response context

Include request info for correlation:

{
  "message": "API request completed",
  "request_id": "req-abc123",
  "trace_id": "trace-xyz789",
  "http_method": "POST",
  "http_path": "/api/login",
  "http_status": 200,
  "http_duration_ms": 42
}

Use request_id to correlate all logs from one request across microservices.

Error tracking

Include error details:

{
  "level": "error",
  "message": "Failed to process payment",
  "error_type": "StripeError",
  "error_message": "Card declined: insufficient funds",
  "stack_trace": "at processPayment (stripe.js:123)\nat checkout (index.js:456)"
}

Error and critical lines are grouped by cause into error groups, using the stack trace, the error type and message, or a fingerprint attribute you send.

Quotas and rate limits

Each organization may store a number of log lines per UTC day:

Plan Log lines per day Retention
Free 100,000 7 days
Pro 2,000,000 30 days
Business 10,000,000 90 days
Enterprise unlimited per contract

When the quota is used up, requests get 429 with {"detail": {"error": "quota_exceeded", ...}} and a Retry-After until 00:00 UTC. Each API key also has a rate limit (default 1,000 requests per minute, adjustable within the plan, see API keys; 429 with "error": "rate_limited"). Fluent Bit, Vector, the OpenTelemetry Collector and the Incidion SDKs (Python, JavaScript, Go) retry 429 and 503 on their own and honour Retry-After.

Logs older than the plan’s retention are deleted automatically. A downgrade hides older logs right away.

OpenTelemetry (OTLP)

Point an OpenTelemetry exporter or Collector at:

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

Both OTLP protobuf (application/x-protobuf) and OTLP JSON (application/json) work, optionally gzip-compressed; other content types get 415. Send the API key in X-API-Key (or Authorization: Bearer) and optionally X-Environment-Id. The same limits apply (10,000 records per request). See OpenTelemetry for the Collector and SDK setup; snippets for the Collector, Fluent Bit and Vector are also in the app under Settings > Projects, a project, Connect a source.

Server metrics

Send server metrics (CPU, memory, disk or your own) to chart them and alert on them:

curl -X POST https://ingest.incidion.dev/v1/metrics \
  -H "X-API-Key: pk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "host": "web-1",
    "metrics": [
      {"name": "cpu_usage", "value": 72.5, "unit": "percent"},
      {"name": "memory_usage", "value": 68.1, "unit": "percent"}
    ],
    "tags": {"region": "eu"}
  }'

timestamp (one for all points, default now) and environment_id are optional; up to 10,000 metrics per request. For one value, POST /v1/metrics/single?host=web-1&name=cpu_usage&value=72.5&unit=percent works without a body. Metrics do not count against the log quota and are kept for 90 days. Charts per host are in the web dashboard under Observe > Server metrics and in the app under Servers; for Linux servers, the ready-made collector script is described in Server monitoring. Use a metric threshold rule to alert on them, and a host stopped reporting rule to be paged when a server goes quiet.

Alert on logs

Alert rules can count matching log lines (log query: for example more than 100 errors from api in 5 minutes), notice a service that went quiet (log absence) or open an incident for every new kind of error (new or spiking errors, on for every project as New errors, see Error groups). They run every minute and resolve themselves when the condition clears. See Alert Rules.

Privacy

Never log:

  • Passwords or API keys
  • Credit card numbers
  • PII (addresses, phone numbers)
  • Session tokens

Incidion stores logs in plain text in databases. Anyone with access to the project can read them.

Troubleshooting

401 Unauthorized: check the key is a pk_ key, correct, active and not expired; detail says which

429 Too Many Requests: the daily quota or the key’s rate limit is reached; wait for Retry-After

413 Request Too Large: Your batch is too big. Reduce logs per batch

422 Unprocessable: every row was rejected, or the body is malformed; errors or detail says why

503 Service Unavailable: storage is briefly unavailable; retry the same batch after Retry-After