Ingest reference
Logs ingest
Send log lines with a log source’s token.
Its operations take the source's token as Authorization: Bearer <token>, never an API key.
Send log lines
POST/api/log-sources/ingest
Sends a batch of log lines with a log source’s token. The body is a JSON envelope {"lines": […]}, a JSON array, one line or newline-delimited JSON, any of them gzipped. Each line carries a message and optionally logged_at, log_level, stream_name and raw_line. An Idempotency-Key makes a retry of the same batch safe for 24 hours.
Limits (by default):
- 1,000 lines in one request.
- A body of 5,242,880 bytes as sent and 20,971,520 bytes after decompression.
- A message of at most 65,536 bytes.
- A
logged_atmore than 300 seconds ahead is clamped to now. - 600 requests a minute for each source.
Headers
- Idempotency-KeystringOptional
Any text of 1 to 255 visible ASCII characters. A repeat of the same batch with the same key within 24 hours is answered as the first was, with the first batch’s
batch_idandlines, and stored once. A different batch under a key used in the last 24 hours is refused with422.
Body parameters
- linesarray of objectsRequired
The lines of the batch.
- messagestringRequired
The log line. A line without one is skipped.
- logged_atstringOptional
When the line was logged: RFC 3339, or a Unix epoch in seconds or milliseconds as a number or a string. A time without a timezone is read as UTC. A missing or unreadable time is the time the line was received.
- log_levelstringOptional
The line’s level. Anything else is dropped rather than stored.
Values:debuginfonoticewarningerrorcriticalalertemergency(an open set: new values may be added) - stream_namestringOptional
The stream the line belongs to; defaults to the source’s slug. Keep it low-cardinality: a stable label, never an id or a timestamp.
- log_sourcestringOptional
An alias for
stream_name, so an agent-shaped payload works unchanged. - raw_linestringOptional
The original unparsed line, if there is one.
Returns
200 OK:
What was stored and how many lines the batch held.
The response panel's status selector shows each failure this operation can answer.