Skip to content
sproutboatDocs
Esc
↑↓navigate↵open⌘Jpreview

Recent log lines of a running app

The last lines of what the app printed (console.log, console.error, uncaught errors) and of the host’s own lines about it (a request line per request, a worker that stopped), oldest first, as plain text lines. The control plane stores none of it: the lines come from the app’s host, which keeps up to about 16 MiB or 7 days of output per app (retention in the answer). Lines have no level here (the host does not record one) and no time in their text; times has the time each line was stored, in the same order (the live stream has times too).

What is removed before a line is returned: the query string of every request URL in the host’s request lines, and every value of the app’s secrets of 8 characters or more (also URL-encoded, JSON-escaped, base64 and hex), replaced by [redacted]. Redaction is best effort: a secret the app slices, hashes or re-encodes is not matched, and a value shorter than 8 characters never is. A line over 16 KiB is cut with an ellipsis.

GET/v1/apps/{project}/logs
Authorization
AuthorizationBearer token · headerrequired

A team API key, sbk_..., from Settings, API keys.

or
x-api-keyAPI key · headerrequired

The same key, in a header of its own.

Path parameters
projectstringrequired

The app's name, unique within the team. 3 to 51 characters (or 1), lowercase letters, digits and dashes, not starting or ending with a dash.

matches ^[a-z0-9](?:[a-z0-9-]{1,49}[a-z0-9])?$
Query parameters
linesinteger

How many of the last lines, 1 to 1000. Default 100.

min 1 · max 1000 · default: 100
Responses
200

The lines.

projectstringrequired
linesstring[]required
timesinteger[]

The time the host stored each line of lines, ms since the epoch, in the same order; null for a line an older host stored (it has no stamp). Absent from a control plane before logs step 2.

retentionstringrequired

How long the host keeps the app's output, in words.

400

The request is malformed. path names the field when one is at fault; some refusals (a digest mismatch, a body that is not JSON) carry a message only.

One of:
ErrorInvalid
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:invalid
ErrorPlain
errorstringrequired

A message for people. Do not parse it.

reasonstring

A stable, machine-readable cause, when there is one.

pathstring

The request field at fault.

needstring

The grant a 403 asks for, app:write for example.

retry_after_sinteger
401

No key, or an invalid, expired or revoked key (unknown or missing API token, invalid, expired or revoked API key). No reason.

errorstringrequired

A message for people. Do not parse it.

reasonstring

A stable, machine-readable cause, when there is one.

pathstring

The request field at fault.

needstring

The grant a 403 asks for, app:write for example.

retry_after_sinteger
403

The key lacks a grant (reason: forbidden, need: "<resource>:<action>").

errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:forbidden
needstringrequired

The grant, as <resource>:<action>, for example app:write.

404

No such app, build, secret, manifest or claim in this team (another team's resource looks the same).

errorstringrequired

A message for people. Do not parse it.

reasonstring

A stable, machine-readable cause, when there is one.

pathstring

The request field at fault.

needstring

The grant a 403 asks for, app:write for example.

retry_after_sinteger
429

Data routes: too many requests in flight or an empty bucket (rate; note retry_after, without _s), or key-rate-limited. Honor Retry-After.

One of:
ErrorKeyRateLimited
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:key-rate-limited
retry_after_sintegerrequired

Seconds to wait; also the Retry-After header.

ErrorRate
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:rate
retry_afterintegerrequired

Seconds to wait; also the Retry-After header.

502

The host agent answered something the Cloud could not handle (reason: agent-error).

errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:agent-error
503

The app's host is not reachable (host-unavailable), the app is not running on it yet (app-not-ready), or the audit log could not record the request (audit-unavailable). Retry shortly.

One of:
ErrorHostUnavailable
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:host-unavailable
ErrorAppNotReady
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:app-not-ready
ErrorAuditUnavailable
errorstringrequired

A message for people. Do not parse it.

reasonstringrequired
Allowed:audit-unavailable
Request
curl -X GET 'https://dash.sproutboat.com/v1/apps/my-app/logs' \
  -H 'Authorization: Bearer YOUR_TOKEN'
Response
{
  "project": "string",
  "lines": [
    "string"
  ],
  "times": [
    0
  ],
  "retention": "string"
}