Setup guide
HTTP API
Send logs from anything that can make an HTTP request: servers, scripts, cron jobs, workers.
Send a line
Add an HTTP / Node.js source and use its token as a bearer key. One request can carry one JSON object, a JSON array, NDJSON (one object per line) or plain text (one line per entry), up to 5,000 lines and 1,024 KB.
curl
curl -X POST https://logyak.com/api/v1/logs \
-H "Authorization: Bearer $LOGYAK_TOKEN" \
-H "Content-Type: application/json" \
-d '{"level":"error","service":"api","message":"Payment failed","order_id":42}'The answer is 202 with how many lines were stored (accepted), refused because the month's allowance is used up (dropped) or could not be read (skipped).
Fields Logyak understands
| Field | Type | Description |
|---|---|---|
| message (or msg, text, log)required | string | The line itself. Without one, an HTTP line is written from its method, path and status, or the whole object is kept as JSON. |
| level (or severity) | string | number | trace, debug, info, warn, error, fatal, or a pino number. Without one it is read from the words and the HTTP status. |
| timestamp (or ts, time) | string | number | ISO 8601, or epoch seconds, milliseconds or microseconds. Without one, the time it arrived. |
| service (or app) | string | Which part of your system wrote it. Search with service:name. |
| host | string | The machine or domain. |
| request_id (or requestId) | string | Follow one request across services with request:id. |
| http.method, http.path, http.status, http.duration_ms | object | Or the same names flat (method, path, status, duration_ms). Makes the line an HTTP line. |
Anything else is kept as attributes and searchable with attr.name:value. A message is cut at 16 KB, attributes at 8 KB.
Errors
| Field | Type | Description |
|---|---|---|
| 401 | Unauthorized | The token is missing, wrong, or belongs to another kind of source. |
| 413 | Payload too large | More lines or bytes than one batch allows. Send smaller batches. |
| 429 | Too many requests | More requests a minute than a source may send. Batch lines together. |
| 503 | Unavailable | The lines could not be stored just now. Send the same batch again shortly. |