# Logs

What the app writes to stdout and stderr, from all its deployments. dudbox keeps 3 days. Build logs are on the deployment: see [Deployments](/docs/api/deployments.md).

The examples use `API=https://dudbox.com/api/v1` and `AUTH="Authorization: Bearer $DUDBOX_TOKEN"`.

### `GET /api/v1/services/{project}/{service}/logs`

The newest lines, oldest first:

```sh
curl -s "$API/services/acme/shop/logs?lines=50" -H "$AUTH"
```

```json
{
  "lines": [
    { "time": "2026-11-04T09:31:10.120Z", "deployment": 44, "stream": "out", "message": "listening on :8080" },
    { "time": "2026-11-04T09:31:11.004Z", "deployment": 44, "stream": "err", "message": "warning: cache is cold" }
  ]
}
```

Query parameters, all optional:

- `lines`: how many of the newest lines, 1 to 5000. Default 200.
- `since`, `until`: only lines in this time, like `2026-11-04T09:00:00Z`.
- `deployment`: only lines of one deployment. Use it to see why a new version did not start.
- `follow=true`: keep the connection open. The answer is then a stream of server-sent events, not JSON:
  - `line`: one line, the same object as above.
  - `end`: sent once, after the old lines (`"history"`). New lines follow as the app writes them.

```sh
curl -sN "$API/services/acme/shop/logs?follow=true&lines=20" -H "$AUTH"
```

Secret env values are not masked in app logs: the app writes what it writes.
