# Log drains, retention and traffic

> Each server ships its services’ logs, redacted, straight to your log service: Unrent never receives a line. A destination is approved with passkeys and its key is sealed to each server. Retention keeps daily, kit-encrypted archives in your own bucket. Traffic analytics come from Caddy’s access log, per minute, without client addresses.

URL: https://unrent.dev/docs/logs/

## Drains

Admins open **Logs** and add a drain: the destination, its region or URL, the key, the servers and, optionally, the environments it takes. The key is sealed in the browser to each server. Each server gets a policy job that approvers sign in **Approvals**; until then nothing is sent.

Destinations

| Destination | Endpoint | Key |
| --- | --- | --- |
| Datadog | Your site (`datadoghq.com`, `datadoghq.eu`, `us3`, `us5`, `ap1`, `ap2`, `uk1`, `ddog-gov.com`, `us2.ddog-gov.com`) | API key |
| Grafana Loki | The push URL host (Grafana Cloud or your own Loki), optional tenant and user | API token or password |
| Better Stack | The source’s ingesting host | Source token |
| Axiom | Edge deployment (US East 1 or EU Central 1) and dataset | API token |
| New Relic | Region (US, EU, Japan, FedRAMP) | License key |
| OTLP/HTTP | Any endpoint (`/v1/logs` is added), optional header name | Header value |
| Webhook | Any HTTPS URL; JSON, signed with `X-Unrent-Signature: sha256=<HMAC-SHA256 of the body>` | Signing secret |

Lines are redacted on the server with the release’s secret values and common token formats, batched every 2 seconds and gzip-compressed. When a destination is slow or down, batches wait in memory, then on the server’s disk (up to 256 MB per drain), and only then are the oldest dropped; the console shows what was sent, queued and dropped. Destinations on your own network need **On my own network**.

## Retention in your bucket

With a recovery kit and an off-site storage target on the server, choose **Keep logs** and the number of days. Each service’s lines are kept per UTC day, encrypted to your recovery kit on the server and uploaded as `_unrent/logs/<environment>/<service>/<day>/…ndjson.gz.age`. Archives older than your days are deleted.

To read one, open **Logs → Archive**, pick the service and days, choose your recovery kit file and open a day: the browser fetches the encrypted file and decrypts it. Without Unrent: `age -d -i kit.txt file.ndjson.gz.age | gunzip`.

## Traffic

**Traffic** shows requests, status classes, p50 and p99 latency, bandwidth and the top paths of each domain, per minute for 2 days and per hour for 30 days. The server counts them from Caddy’s access log; client addresses, headers, cookies and query strings are removed before counting, and identifiers in paths are collapsed (`/orders/:id`).
