Skip to content

Events and time

What an event is, event time versus received time, and what an accepted batch guarantees.

Updated

An event is one structured log record. It carries two timestamps: the one your application set, and the one Logbrook recorded when it arrived.

What an event contains

You send events as JSON objects. Logbrook reads a fixed set of fields from each object and keeps everything else as attributes. The wire names follow the Pino log format.

Stored field Wire name Required Meaning
event_time time Yes Producer time, an integer in Unix milliseconds.
level level Yes Severity as a nonnegative integer. Logbrook does not name levels; it keeps the producer’s numeric scale.
message msg Yes The text shown for the event.
service service No The application or component that produced the event.
logger name No The logger name.
host hostname No The host that produced the event.
pid pid No Process ID, a nonnegative integer.
attributes every other key No The rest of the object, kept as JSON.

Logbrook adds three fields when it stores the event.

Field Meaning
id A server-assigned identifier, returned as a decimal string. It is unique within an index and grows with ingestion order.
source The source name tied to the ingestion token. Producers cannot set it. See indexes, services and sources.
received_at When the server received the event, in Unix milliseconds.

The ID and the source never come from the payload. A payload key named id or source is stored as an ordinary attribute.

For complete payloads, see send logs over HTTP.

Event time and received time

Event time is the timestamp your application put on the event. Received time is when Logbrook accepted it. The two differ whenever a producer buffers, retries or replays logs.

Logbrook uses event time for:

  • search, count, facet and histogram ranges
  • ordering search results, newest first
  • deciding when an event is archived
  • deciding when an event expires

Live tail follows ingestion order instead. A delayed event appears in tail when it arrives, not where its timestamp would put it.

Event time answers “what happened between 14:00 and 14:05”. Ingestion order answers “what just arrived”.

Limits on event time

Live ingestion checks event time against the clock and the retention window:

  • An event more than max_future_skew_ms ahead of server time is rejected. The default is 5 minutes and the maximum is one day.
  • An event older than the index’s retention window is rejected, because it would expire immediately.
  • Event time must fall between the Unix epoch and 9999-12-31T23:59:59.999Z.

Offline imports keep historical timestamps. Set retention to cover imported history before you start the server, or the first maintenance pass expires it.

Accepted batches

Logbrook validates a batch as a whole: one invalid event rejects the request and stores nothing. A valid batch is committed in one storage transaction, and only then does the response report the number of accepted events:

{ "accepted": 2 }

An accepted batch is therefore durable.

Duplicates on retry

If a request times out or the connection drops, the batch may or may not have committed. Logbrook has no idempotency keys and no deduplication, so a retry after an unknown outcome can store the same events twice.

In your producer:

  • Retry only when the outcome is unknown or the request was rejected, and expect occasional duplicates.
  • Treat 429 as a rejection. The server did not store the batch, and the response includes Retry-After: 1.
  • Keep batches small enough that a retry is cheap.

The same applies to Fluent Forward: the server acknowledges after the commit, and a sender that retries after a lost acknowledgment can store duplicates.

The writer can commit several queued requests in one transaction, but each request is validated separately and gets its own response. Send events in batches, not one request per event.

Next steps

Type to search…

↑↓ navigate↵ selectEsc close