API reference
Live tail API reference
Reference for the /v1/tail WebSocket: subprotocol, frames in both directions, resume and close codes, generated from the ZevSight OpenAPI file.
Stream matching events over WebSocket as they arrive.
Stream matching events as they arrive. Guide: Live tail.
Base URL: wss://eu.zevsight.com. Machine-readable: /openapi.yaml.
Open a live tail
wss://eu.zevsight.com/v1/tail Live tail over WebSocket.
Upgrade to WebSocket (Sec-WebSocket-Protocol: zevsight.tail.v1).
No credential in the URL. Frames are JSON text. See https://docs.zevsight.com/explore/live-tail.
Client → server
TailAuth— first frame, within 5 s, or the socket closes with 4401.TailSubscribe— start, or change the filter (replaces the previous one).TailAuthagain before the ticket expires, to keep the socket.{"type":"pause"}/{"type":"resume"}.
Server → client
TailLinesevery ≤75 ms while lines match.TailCaughtUponce, after the catch-up fromresume_from.TailLaggingwhen the client cannot keep up.TailError, then close. One exception: anUNAVAILABLEerror after a subscribe means the catch-up of recent lines failed; the socket stays open and streams new lines.- A
TailLaggingframe withskipped: -1after a catch-up means more than 10,000 lines matched sinceresume_from; fetch the rest with search.
A subscribe with resume_from sends lines with received_at from 2 s
before it (the overlap absorbs clock differences between gateways);
drop lines whose id is already shown. {"type":"resume"} after a
pause catches up from the last line sent, so pausing leaves no gap.
Close codes: 4400 invalid subscribe (bad filter, unknown frame), 4401
unauthenticated or key revoked, 4403 project not readable, 4408
ticket expired (send a fresh TailAuth before exp), 4429 too many
tails for the organization.
Authentication: none. The token in the URL is the credential.
Responses
| Status | Description |
|---|---|
101 | Switching protocols. Every frame on the socket, in both directions, is a TailFrame. |
426 | Not a WebSocket upgrade request, or the wrong subprotocol. |
Frames
Every frame is a JSON text message with a type.
auth (client → server)
| Field | Type | Required | Description |
|---|---|---|---|
type | "auth" | yes | |
token | string | yes | Engine ticket, read key or agent key. |
subscribe (client → server)
| Field | Type | Required | Description |
|---|---|---|---|
type | "subscribe" | yes | |
projects | array of string | yes | Project public ids, or [“all”]. |
q | string | Same grammar as /v1/query/logs. | |
environments | array of string | Like env= on search. | |
resume_from | string (date-time) | received_at of the newest line the client already shows. |
lines (server → client)
| Field | Type | Required | Description |
|---|---|---|---|
type | "lines" | yes | |
lines | array of EventOut | ||
lines[].id | string (uuid) | yes | UUIDv7. Omit to have one generated. |
lines[].environment | string | yes | Default production. Pattern ^[a-z0-9][a-z0-9._-]{0,63}$. |
lines[].service | string | yes | Default unknown. Pattern ^[a-z0-9][a-z0-9._-]{0,63}$. |
lines[].type | string | yes | One of log, heartbeat, check_result. |
lines[].ts | string (date-time) | yes | |
lines[].trace_id | string | Pattern ^[0-9a-f]{32}$. | |
lines[].span_id | string | Pattern ^[0-9a-f]{16}$. | |
lines[].severity | string | One of trace, debug, info, warn, error, fatal. | |
lines[].attrs | object | Up to 128 keys. Map of string to string (values up to 8192 characters). | |
lines[].resource | object | Up to 128 keys. Map of string to string (values up to 8192 characters). | |
lines[].body | one of LogBody, HeartbeatBody, CheckResultBody | yes | |
lines[].body.message | string | yes | (LogBody) Truncated above 64 KiB. |
lines[].body.fields | object | (LogBody) | |
lines[].body.monitor_id | string | yes | (HeartbeatBody) |
lines[].body.status | string | yes | (HeartbeatBody) One of start, ok, fail. |
lines[].body.duration_ms | integer | (HeartbeatBody) At least 0. | |
lines[].body.note | string | (HeartbeatBody) Up to 8192 characters. | |
lines[].body.check_id | string | yes | (CheckResultBody) |
lines[].body.region | string | yes | (CheckResultBody) |
lines[].body.node_id | string | yes | (CheckResultBody) |
lines[].body.config_version | integer | yes | (CheckResultBody) |
lines[].body.status | string | yes | (CheckResultBody) One of up, down, degraded. |
lines[].body.latency_ms | integer | yes | (CheckResultBody) At least 0. |
lines[].body.detail | object | (CheckResultBody) Map of string to string. | |
lines[].body.error | string | (CheckResultBody) Short reason when not up; omitted when up. | |
lines[].body.signature | string | yes | (CheckResultBody) |
lines[].project | string | yes | Project public id. |
lines[].received_at | string (date-time) | yes |
caught_up (server → client)
| Field | Type | Required | Description |
|---|---|---|---|
type | "caught_up" | yes |
lagging (server → client)
| Field | Type | Required | Description |
|---|---|---|---|
type | "lagging" | yes | |
skipped | integer | ||
resume_from | string (date-time) |
error (server → client)
| Field | Type | Required | Description |
|---|---|---|---|
type | "error" | yes | |
error | object | ||
error.code | string | yes | One of INVALID_REQUEST, UNAUTHENTICATED, NOT_FOUND, PAYLOAD_TOO_LARGE, RATE_LIMITED, QUOTA_EXCEEDED, UNAVAILABLE, INTERNAL_ERROR, WRONG_REGION. |
error.message | string | yes | A sentence for a person. |
error.field | string | ||
error.reference | string | Present on INTERNAL_ERROR; quote it to support. | |
error.endpoint | string | Present on WRONG_REGION: the ingest host of the region the credential belongs to. |
Example
// Node 22+ or any browser: the WebSocket API is built in.
const ws = new WebSocket('wss://eu.zevsight.com/v1/tail', 'zevsight.tail.v1');
ws.onopen = () => {
ws.send(JSON.stringify({ type: 'auth', token: process.env.ZEVSIGHT_API_KEY }));
ws.send(JSON.stringify({
type: 'subscribe',
projects: ['all'],
environments: ['production'],
q: 'level:>=warn service:api',
}));
};
ws.onmessage = (msg) => {
const frame = JSON.parse(msg.data);
if (frame.type === 'lines') for (const e of frame.lines) console.log(e.ts, e.severity, e.body?.message);
if (frame.type === 'lagging') console.warn('skipped', frame.skipped, 'lines; resume_from', frame.resume_from);
if (frame.type === 'error') console.error(frame.error.code, frame.error.message);
};
ws.onclose = (e) => console.log('closed', e.code); // 4401 auth, 4403 project, 4429 too many tails Built 29 November 2026 · View as Markdown