LogFlux API Reference

LogFlux has two APIs. The Ingestion API is the cloud endpoint that receives encrypted logs. The Agent API is a local socket interface for sending logs to the agent running on your machine.

Ingestion APIAgent API
TransportHTTPS (multipart/mixed)Unix socket or TCP (NDJSON)
EndpointPOST /v1/ingest/var/run/logflux-agent/agent.sock or 127.0.0.1:8765
AuthenticationAPI Key (Bearer {region}-lf_<key>)None (Unix) or shared secret (TCP)
EncryptionClient encrypts before sendingAgent encrypts before forwarding
Entry types1-7 (all types)1-5 (Log, Metric, Trace, Event, Audit)
Batch limit1000 entries per request100 entries per batch
Used byAgent, SDKs (direct mode)SDKs (agent mode), plugins, custom apps
  • Ingestion API – Cloud REST API. Multipart/mixed format, encryption handshake, rate limits, regional endpoints.
  • Agent API – Local socket API. Unix/TCP transport, NDJSON messages, authentication, batch submission.

Payload Schema (v2.0)

Both APIs accept the same JSON payload format. This is the JSON that gets compressed and encrypted before transmission. The server never sees plaintext.

Common Fields

Every payload contains these fields regardless of entry type:

FieldTypeRequiredDescription
vstringYesSchema version, always "2.0"
typestringYesEntry type: log, metric, trace, event, audit, telemetry
sourcestringYesOriginating service/component (max 256 chars)
levelintNoSyslog severity 1-8 (default: 7 = info)
tsstringNoRFC 3339 timestamp (default: ingestion time)
attributesobjectNoUser-defined string key-value pairs (max 50 keys, key max 64 chars, value max 256 chars)
metaobjectNoSDK/system metadata (not user-facing)

Log (type 1)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
  "v": "2.0",
  "type": "log",
  "source": "api-server",
  "level": 4,
  "ts": "2026-03-18T14:30:45.789Z",
  "message": "Connection timeout after 5s",
  "logger": "db.pool",
  "attributes": {
    "request_id": "req_abc123",
    "db_host": "primary.db.internal"
  }
}
FieldTypeRequiredDescription
messagestringYesLog message (max 8,192 chars)
loggerstringNoLogger name / category (max 256 chars)

Metric (type 2)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{
  "v": "2.0",
  "type": "metric",
  "source": "api-server",
  "ts": "2026-03-18T14:30:45.789Z",
  "name": "http.request.duration",
  "value": 142.5,
  "unit": "millisecond",
  "kind": "distribution",
  "attributes": {
    "method": "GET",
    "route": "/api/users",
    "status": "200"
  }
}
FieldTypeRequiredDescription
namestringYesMetric name, dot-notation (e.g. http.request.duration)
valuenumberYesNumeric value
unitstringNoUnit: millisecond, second, byte, percent, per_second, etc. Default: none
kindstringNocounter, gauge, or distribution. Default: gauge

Trace (type 3)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{
  "v": "2.0",
  "type": "trace",
  "source": "api-server",
  "ts": "2026-03-18T14:30:45.789Z",
  "trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
  "span_id": "00f067aa0ba902b7",
  "parent_span_id": "b3dc45a03e2d5b7e",
  "operation": "http.server",
  "name": "GET /api/users",
  "start_time": "2026-03-18T14:30:45.789Z",
  "end_time": "2026-03-18T14:30:45.932Z",
  "duration_ms": 143,
  "status": "ok",
  "attributes": {
    "http.method": "GET",
    "http.status_code": "200"
  }
}
FieldTypeRequiredDescription
trace_idstringYesW3C Trace Context format (32 hex chars)
span_idstringYesUnique span identifier (16 hex chars)
parent_span_idstringNoParent span ID (omit for root spans)
operationstringYesOperation category (e.g. http.server, db.query)
namestringYesSpan name (max 256 chars, low cardinality)
start_timestringYesRFC 3339 span start
end_timestringYesRFC 3339 span end
duration_msnumberNoConvenience field (end - start)
statusstringNook or error. Default: ok

Event (type 4)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
  "v": "2.0",
  "type": "event",
  "source": "auth-service",
  "ts": "2026-03-18T14:30:45.789Z",
  "event": "user.signup",
  "attributes": {
    "user_id": "usr_987",
    "plan": "starter",
    "method": "oauth_google"
  }
}
FieldTypeRequiredDescription
eventstringYesEvent name, dot-notation (e.g. user.signup, payment.failed)

Audit (type 5)

Stored with Object Lock (GOVERNANCE mode, 365-day undeletable retention).

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{
  "v": "2.0",
  "type": "audit",
  "source": "billing-service",
  "level": 6,
  "ts": "2026-03-18T14:30:45.789Z",
  "action": "record.deleted",
  "actor": "usr_456",
  "actor_type": "user",
  "resource": "invoice",
  "resource_id": "inv_789",
  "outcome": "success",
  "attributes": {
    "reason": "customer_request",
    "ip": "10.0.1.42",
    "previous_state": "active",
    "new_state": "deleted"
  }
}
FieldTypeRequiredDescription
actionstringYesWhat happened (e.g. record.deleted, permission.granted)
actorstringYesWho did it (user ID, service name, or system)
actor_typestringNouser, service, system, or api_key. Default: user
resourcestringYesWhat was affected (e.g. invoice, user, api_key)
resource_idstringYesIdentifier of affected resource
outcomestringNosuccess, failure, or denied. Default: success

Telemetry (types 6 and 7)

Type 6 uses E2E encryption. Type 7 (TelemetryManaged) uses server-side encryption only – same payload schema, different X-LF-Entry-Type header.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
{
  "v": "2.0",
  "type": "telemetry",
  "source": "edge-gateway-01",
  "ts": "2026-03-18T14:30:45.789Z",
  "device_id": "dev_001",
  "readings": [
    {"name": "cpu_temp", "value": 72.5, "unit": "celsius"},
    {"name": "memory_used", "value": 85.2, "unit": "percent"},
    {"name": "disk_iops", "value": 1250, "unit": "per_second"}
  ],
  "attributes": {
    "firmware": "2.1.0",
    "region": "eu-west-1"
  }
}
FieldTypeRequiredDescription
device_idstringYesDevice/sensor identifier (max 256 chars)
readingsarrayYesMeasurement objects (max 100)
readings[].namestringYesReading name
readings[].valuenumberYesMeasurement value
readings[].unitstringNoUnit (same options as Metric type)

Attributes

The attributes object is a flat string-value map available on every entry type:

ConstraintValue
Max keys per entry50
Key length1-64 chars, lowercase, dots/underscores
Value length1-256 chars (numbers converted to strings)
Reserved prefixlf.* (LogFlux internal)

Follow OpenTelemetry semantic conventions where applicable: http.method, http.status_code, db.system, user.id, service.name, deploy.environment.


Entry Types

TypeNameCategoryEncryptionPricing
1LogEventsE2E (AES-256-GCM)Events
2MetricEventsE2E (AES-256-GCM)Events
3TraceTracesE2E (AES-256-GCM)Traces
4EventEventsE2E (AES-256-GCM)Events
5AuditAuditE2E (AES-256-GCM) + Object LockAudit
6TelemetryTracesE2E (AES-256-GCM)Traces
7TelemetryManagedTracesServer-side (S3 SSE-KMS)Traces

Entry types affect pricing category and storage behavior.

Payload Types

ValueNameUsed ByDescription
1aes256-gcm-gzip-jsonTypes 1-6 (default)AES-GCM encrypted, gzip-compressed JSON
2aes256-gcm-zstd-jsonTypes 1-6AES-GCM encrypted, zstd-compressed JSON
3gzip-jsonType 7 onlyGzip-compressed JSON (no client encryption)
4zstd-jsonType 7 onlyZstd-compressed JSON (no client encryption)

Size Limits

LimitValue
Max payload (JSON before compression)1 MiB
Max entries per request1,000
Max request body10 MiB
Max message / event / action field8,192 chars
Max attribute key64 chars
Max attribute value256 chars
Max attributes per entry50
Max telemetry readings100