HTTP ingestion
Everything speaks HTTP, so everything can log to Kinglet. The ingest endpoint accepts two shapes:
NDJSON (recommended)
Section titled “NDJSON (recommended)”One JSON object per line — cheap to stream, trivial to produce:
POST /v1/eventsAuthorization: Bearer kl_…Content-Type: application/x-ndjson
{"level":"error","message":"payment failed","service":"billing","fields":{"order":1234}}{"level":"info","message":"retry scheduled","service":"billing"}JSON batch
Section titled “JSON batch”A single object with an events array, or a bare array:
{ "events": [ { "level": "warn", "message": "cache miss", "service": "api" }, { "level": "info", "message": "user signed in", "service": "web" } ]}Event fields
Section titled “Event fields”| Field | Required | Notes |
|---|---|---|
message (or msg) |
yes | the log line, up to 8,000 characters |
level |
no | trace…fatal, or a number 0–5; unknown values default to info |
ts (or time/timestamp) |
no | epoch ms, epoch seconds (auto-detected), or ISO string; defaults to now |
service |
no | lowercase identifier, shown and filterable in the UI |
env |
no | e.g. prod, staging |
fields |
no | arbitrary JSON object up to 32 KB serialized |
Limits
Section titled “Limits”- Request body: 8 MB
- Events per batch: 10,000 (extras are dropped and reported in the response)
Invalid events don’t fail the batch — Kinglet returns
{ "accepted": n, "rejected": m } so one bad line never blocks your pipeline.
Ship without changing your app
Section titled “Ship without changing your app”Anything that can POST NDJSON with a bearer token works today. For example, Vector:
[sinks.kinglet]type = "http"inputs = ["my_source_transform"]uri = "http://kinglet:8080/v1/events"encoding.codec = "ndjson"
[sinks.kinglet.request]headers.Authorization = "Bearer kl_…"