Live tail streams events as they are ingested, over Server-Sent Events (SSE). It’s HTTP only: the logbrook CLI has no tail command, so use curl or an SSE client.
Start a tail
curl --fail-with-body --silent --show-error --no-buffer --get \
"$LOGBROOK_URL/indexes/checkout/logs/tail" \
-H "Authorization: Bearer $LOGBROOK_READ_TOKEN" \
--data-urlencode 'service=api' --data-urlencode 'min_level=50'The connection stays open until you interrupt it. Without a resume header, tail starts after the newest committed event and doesn’t replay history. For that, use search.
Send an event from a second terminal to see frames like these:
event: log
id: checkout:v1.<opaque-resume-token>
data: { "id": "3", "source": "production", ... }
event: cursor
id: checkout:v1.<opaque-resume-token>
data: caught up| Frame | Meaning |
|---|---|
log |
One event. data is the complete event JSON. |
cursor |
The stream has caught up. Its id is a resume point even if your filters matched nothing. |
gap |
The stream ended because events cannot be replayed. See below. |
error |
The stream ended because the tail query failed. |
Keepalive comments can appear between frames. IDs from /indexes/{index}/logs/tail start with the index name. IDs from the unprefixed /logs/tail route don’t.
Filter the stream
Tail accepts source, service, logger, host, message, min_level and filter, with the same meaning as in search and attribute filters. It rejects from, to, since, limit, cursor and interval_ms with 400. The unprefixed /logs/tail route tails the default index.
Ordering
Tail follows ingestion order, not event time. An event that arrives late with an older event_time appears after newer ones. Search and live tail explains why.
Resume after a disconnect
Save the SSE id of the last log or cursor frame you processed. Reconnect with it in the Last-Event-ID header:
export LAST_TAIL_ID='<exact id from the SSE stream>'
curl --fail-with-body --silent --show-error --no-buffer --get \
"$LOGBROOK_URL/indexes/checkout/logs/tail" \
-H "Authorization: Bearer $LOGBROOK_READ_TOKEN" \
-H "Last-Event-ID: $LAST_TAIL_ID" \
--data-urlencode 'service=api' --data-urlencode 'min_level=50'The server replays matching events still retained after that point, then follows new ones.
- Use the same index, route style and filters. A resume ID with different filters returns
400before the stream starts. - Send the ID unchanged, including any index prefix.
- A search
next_cursoror an event’s JSONidis not a resume ID.
Neither the server nor curl reconnects for you. Store IDs and reconnect in your client.
Gaps
A gap frame ends the stream. It means the resume point has expired under retention, or the next event is larger than the per-subscriber output limit. Resuming can’t recover expired events, so search the retained history for the period you missed, then start a new tail.
An error frame also ends the stream. Reconnect, or search the retained history.
A long replay doesn’t cause a gap by itself. If the first event to replay exceeds the output limit, the request fails with 413 before streaming starts.
Limits
| Limit | Default |
|---|---|
| Concurrent tail subscribers | 8 |
| Output bytes per subscriber | 1 MiB |
Past the subscriber limit, new tails get 429 with Retry-After: 1. Tail limits are shared by all indexes.