Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.logclaw.ai/llms.txt

Use this file to discover all available pages before exploring further.

Ingestion API

Logs are ingested into LogClaw exclusively via OTLP (OpenTelemetry Protocol). The OTel Collector accepts both gRPC and HTTP transports.

Send Logs (HTTP/JSON)

method
string
default:"POST"
HTTP method
POST /v1/logs
Send log records in OTLP HTTP/JSON format. LogClaw Cloud (managed): POST https://otel.logclaw.ai/v1/logs Via Dashboard proxy (self-hosted): POST /api/otel/v1/logs Direct (self-hosted): POST http://logclaw-otel-collector:4318/v1/logs

Authentication

LogClaw Cloud requires an API key via the x-logclaw-api-key header. Get your key from console.logclaw.ai under Settings → API Keys. See API Keys for details.Self-hosted deployments do not require authentication — access is controlled at the Kubernetes NetworkPolicy level.

Request Headers

HeaderValue
Content-Typeapplication/json
x-logclaw-api-keylc_proj_... (required for LogClaw Cloud, not needed for self-hosted)

Request Body

{
  "resourceLogs": [
    {
      "resource": {
        "attributes": [
          {
            "key": "service.name",
            "value": { "stringValue": "payment-api" }
          },
          {
            "key": "host.name",
            "value": { "stringValue": "pod-abc123" }
          }
        ]
      },
      "scopeLogs": [
        {
          "logRecords": [
            {
              "timeUnixNano": "1709312400000000000",
              "severityText": "ERROR",
              "severityNumber": 17,
              "body": {
                "stringValue": "Connection refused to database"
              },
              "traceId": "abcdef1234567890abcdef1234567890",
              "spanId": "abcdef1234567890",
              "attributes": [
                {
                  "key": "environment",
                  "value": { "stringValue": "production" }
                },
                {
                  "key": "region",
                  "value": { "stringValue": "us-east-1" }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

Response

200 OK
{
  "partialSuccess": {}
}
An empty partialSuccess object means all records were accepted.

OTLP Field Reference

FieldTypeRequiredDescription
resourceLogsarrayYesArray of resource log groups
resource.attributesarrayNoResource-level attributes (service.name, host.name, etc.)
scopeLogsarrayYesArray of scope log groups
logRecordsarrayYesArray of individual log records
timeUnixNanostringNoTimestamp in nanoseconds since epoch
severityTextstringNoSeverity level: TRACE, DEBUG, INFO, WARN, ERROR, FATAL
severityNumberintegerNoNumeric severity (1-24)
body.stringValuestringYesThe log message
traceIdstringNo32-character hex trace ID
spanIdstringNo16-character hex span ID
attributesarrayNoAdditional key-value attributes

Attribute Value Types

OTLP attributes support multiple value types:
{"key": "name", "value": {"stringValue": "hello"}}
{"key": "count", "value": {"intValue": "42"}}
{"key": "ratio", "value": {"doubleValue": 3.14}}
{"key": "enabled", "value": {"boolValue": true}}

Send Logs (gRPC)

LogClaw Cloud (managed): grpc://otel.logclaw.ai:443 Direct (self-hosted): grpc://logclaw-otel-collector:4317 Use the OTLP gRPC exporter from any OpenTelemetry SDK. This is the recommended transport for production workloads — binary Protobuf is more compact and efficient than JSON.
LogClaw Cloud gRPC uses TLS on port 443. Set your SDK’s insecure option to false (the default). Authentication via x-logclaw-api-key header is required — the same as HTTP.
See the OTLP Integration Guide for SDK examples in Python, Java, Node.js, and Go.

Health Check

GET http://logclaw-otel-collector:13133/
Response:
{
  "status": "Server available",
  "upSince": "2024-01-15T10:30:00Z",
  "uptime": "48h30m"
}

Examples

curl — Single Log (LogClaw Cloud)

curl -X POST https://otel.logclaw.ai/v1/logs \
  -H "Content-Type: application/json" \
  -H "x-logclaw-api-key: $LOGCLAW_API_KEY" \
  -d '{
    "resourceLogs": [{
      "resource": {
        "attributes": [
          {"key": "service.name", "value": {"stringValue": "my-app"}}
        ]
      },
      "scopeLogs": [{
        "logRecords": [{
          "timeUnixNano": "'$(date +%s)000000000'",
          "severityText": "ERROR",
          "body": {"stringValue": "Connection timeout"}
        }]
      }]
    }]
  }'

curl — Single Log (Self-Hosted)

curl -X POST http://localhost:4318/v1/logs \
  -H "Content-Type: application/json" \
  -d '{
    "resourceLogs": [{
      "resource": {
        "attributes": [
          {"key": "service.name", "value": {"stringValue": "my-app"}}
        ]
      },
      "scopeLogs": [{
        "logRecords": [{
          "timeUnixNano": "'$(date +%s)000000000'",
          "severityText": "ERROR",
          "body": {"stringValue": "Connection timeout"}
        }]
      }]
    }]
  }'

curl — Batch (Multiple Records, LogClaw Cloud)

curl -X POST https://otel.logclaw.ai/v1/logs \
  -H "Content-Type: application/json" \
  -H "x-logclaw-api-key: $LOGCLAW_API_KEY" \
  -d '{
    "resourceLogs": [{
      "resource": {
        "attributes": [
          {"key": "service.name", "value": {"stringValue": "batch-test"}}
        ]
      },
      "scopeLogs": [{
        "logRecords": [
          {
            "timeUnixNano": "'$(date +%s)000000000'",
            "severityText": "INFO",
            "body": {"stringValue": "Request started"}
          },
          {
            "timeUnixNano": "'$(date +%s)000000000'",
            "severityText": "ERROR",
            "body": {"stringValue": "Database connection failed"}
          },
          {
            "timeUnixNano": "'$(date +%s)000000000'",
            "severityText": "WARN",
            "body": {"stringValue": "Retrying in 5 seconds"}
          }
        ]
      }]
    }]
  }'