# Logs and observability

> Every request, its function run, your app’s output and its outgoing calls, kept in your own account and searchable from the dashboard or the CLI.

- Category: Monitor
- URL: https://www.forkrail.com/docs/logs-and-observability

## What’s kept

The routers log every request and send it to the analytics store, a ClickHouse server in your own AWS account. Nothing goes to a third party.

| What | Details |
| --- | --- |
| Requests | Host, deployment, method, path, query, status, timings (queued, first byte, total), bytes, client IP, user agent, location, and the rule that routed it. Query parameters named like `key`, `token` or `secret` are masked. |
| Function runs | Environment, runtime, memory used against the memory size, duration against max duration, the route template (`/items/{item_id}`), and how it started: `warm`, `thaw` or `cold`. |
| Your app’s output | stdout and stderr, tagged with the request they belong to. |
| Outgoing requests | Each HTTP call your app makes while serving a request: host, path, status, duration and size. Timed for Python (requests, httpx, aiohttp, urllib, curl_cffi) and Node (fetch, `node:http`) without changing your code. |
| Problems | Retries, crashes, timeouts, cut-off responses and upstream failures. |
| A copy in S3 | Every 10 minutes, as JSON lines, in the install’s artifacts bucket under `logs/router/`. |

Every response has an `x-forkrail-request-id` header. Ask a user for it and you can find their exact request.

### App output limits

Each request keeps up to 256 lines and 1 MB of output, and a line can be 256 KB, as on Vercel. There’s no limit per second, so a busy deployment keeps every request’s output. Output past a request’s limits, and lines printed outside any request (start-up, background threads), share 128 KB a second per deployment. What isn’t kept is counted, and the request panel says how much is missing.

## In the dashboard

- **Logs** (team or project): requests by default; switch to **All traffic** to include server functions and app output. Filter by status, type, method, domain, deployment, path or text, and open a request to see its timeline, function run, outgoing calls and output.
- **Observability**: charts for requests, functions (duration, memory, cold starts), middleware, cache hits and external APIs, over any time range.
- **Usage**: requests, function time, transfer and cost per project, from the routers’ count and from AWS’s bill.

## From the CLI

```bash
forkrail logs my-api                              # the last hour's requests, newest last
forkrail logs my-api --status 5xx --since 1d
forkrail logs my-api --path /search -f            # follow: new requests every 2 seconds
forkrail logs my-api --request 1f3a9c0d2e4b5a6c   # one request in full, with its output
forkrail logs my-api --app --level error --since 6h   # your app's output; --search TEXT
forkrail stats my-api --since 7d                  # status, latency, cold starts, busiest paths
forkrail usage --since 30d                        # requests, GB-seconds, transfer and cost per project
forkrail usage my-api --daily
```

| Option | Does | Default |
| --- | --- | --- |
| `--since`, `--until` | Time range: `30s`, `15m`, `2h`, `7d` or a UTC time | Last hour (`stats`: 24 hours, `usage`: 30 days) |
| `--status` | A class (`5xx`) or a code (`404`) | All |
| `--path`, `--host` | Paths starting with, or one hostname | All |
| `-n`, `--limit` | The newest N rows | 100 |
| `-f`, `--follow` | Keep printing new rows | Off |
| `--app`, `--level`, `--search` | Your app’s output, by level or text | Requests |

## Location headers your app gets

The router looks up each visitor’s location and passes it on as Vercel does: `x-vercel-ip-country`, `x-vercel-ip-continent`, `x-vercel-ip-city`, `x-vercel-ip-latitude` and `x-vercel-ip-longitude`, plus `x-real-ip` and `x-forwarded-for`. Any the client sent are removed first.

Locations come from DB-IP’s free databases (CC BY 4.0), refreshed monthly. They have no region codes, time zones or postal codes, so `x-vercel-ip-country-region`, `-timezone` and `-postal-code` aren’t sent.

## Cost

Logs are part of the install’s fixed cost: the analytics server (about $0.90 a day with its 50 GB disk) and the S3 copy. Request logs, function runs and app output have no expiry set, and the S3 copy is kept too. There’s no per-GB log charge and no log drain to pay for.
