---
title: "Run in production"
description: "Deploy the container image securely, own the data directory, and size the host."
---

> Documentation Index
> Fetch the complete documentation index at: https://sandrinodm.github.io/logbrook/llms.txt
> Use this file to discover all available pages before exploring further.

# Run in production

Run the published image with the hardening the Compose file uses, give it a data directory that it alone owns, and work through the [checklist](#production-checklist) before you point real producers at it.

## What is in the image

The image holds the `logbrook` executable and its runtime libraries, with no build tools or source files.

- The runtime stage is a digest-pinned, multi-architecture `gcr.io/distroless/cc-debian13:nonroot` image. It supplies glibc, the C++ runtime that bundled DuckDB needs, and CA roots.
- There is no shell and no package manager. Run client commands with `docker exec <container> logbrook ...`.
- The process runs directly as UID and GID `10001:10001`. Docker sends `SIGTERM` to it (`STOPSIGNAL SIGTERM`).
- The image sets `LOGBROOK_BIND=0.0.0.0:3100` and `LOGBROOK_DATA_DIR=/data`, declares `/data` as a volume, and exposes `3100`, plus `24224` (TCP and UDP) for the optional Forward listener.
- The default command is `serve`.
- The license is at `/usr/share/licenses/logbrook/LICENSE`. Dependency licenses and notices are at `/usr/share/licenses/logbrook/THIRD_PARTY_NOTICES.txt`.
- The built-in healthcheck runs `logbrook healthcheck` every 30 seconds with a 5 second timeout, a 15 second start period and 3 retries. It calls `/ready` without credentials and needs no shell.

## Run with hardening

The [Compose file](https://github.com/sandrinodm/logbrook/blob/main/compose.yaml) sets these options. Use the equivalents wherever you run the container.

```sh
docker run -d --name logbrook \
  --read-only \
  --tmpfs /tmp:rw,noexec,nosuid,size=256m,mode=1777 \
  --cap-drop ALL \
  --security-opt no-new-privileges:true \
  --stop-timeout 35 \
  --restart unless-stopped \
  -p 127.0.0.1:3100:3100 \
  -v logbrook-data:/data \
  -e LOGBROOK_INGEST_TOKEN \
  -e LOGBROOK_READ_TOKEN \
  ghcr.io/sandrinodm/logbrook:0.5.0
```

| Setting | Why |
| --- | --- |
| Read-only root file system | Only `/data` and `/tmp` need to be writable. |
| 256 MiB `/tmp` tmpfs | Scratch space without a writable root. |
| `--cap-drop ALL`, `no-new-privileges` | The process needs no capabilities. |
| 35 second stop timeout | Graceful shutdown takes up to 30 seconds (`shutdown_timeout_secs`), and Docker must wait longer than that before it sends `SIGKILL`. |
| Publish on `127.0.0.1` | Logbrook serves plain HTTP. See [listen address and ports](#listen-address-and-ports). |

> **Pin the image**
>
> Use a version tag such as `0.5.0` or a digest, not `latest`. See [Releases and container images](https://sandrinodm.github.io/logbrook/project/releases/).

## Own the data directory

- **One process per data directory.** Never run two Logbrook processes on the same data root or mount one volume into two containers.
- **Ownership.** `/data` in the image is writable and owned by UID `10001`, including on a fresh named volume. A bind mount must have the same ownership: `chown -R 10001:10001 /srv/logbrook`.
- **Keep other files out.** At startup Logbrook removes `.tmp` and unreferenced `.parquet` files from each archive directory, and it cleans `.index-trash/`. Do not store anything else there.
- **No symlinks.** Index directories and files cannot be symlinks.
- **Path rules.** The data directory path must be UTF-8 and cannot contain `*`, `?`, `[` or `]`.
- **Take backups offline.** See [backup, restore and upgrade](https://sandrinodm.github.io/logbrook/operate/backup-and-upgrade/).

## Listen address and ports

| Setting | Value |
| --- | --- |
| Native default bind | `127.0.0.1:3100` |
| Container bind | `0.0.0.0:3100` (set by `LOGBROOK_BIND` in the image) |
| Forward listener | Off until a configuration file enables it; the image exposes `24224` |

If you change the port inside the container, set `LOGBROOK_BIND` to match, because the healthcheck reads the address from `--config` or `LOGBROOK_BIND`.

Logbrook does not terminate TLS for the HTTP API, and tokens travel in the `Authorization` header. For remote access, put a TLS-terminating reverse proxy in front and keep the container port on loopback or a private network.

If you also run the [web UI](https://sandrinodm.github.io/logbrook/web-ui/), it needs its own authenticating proxy: the UI has no login of its own. See [Run the UI](https://sandrinodm.github.io/logbrook/web-ui/deploy/).

## Sizing

There are no published sizing figures, so measure with your own workload. Account for the following.

- **DuckDB memory is not the process memory.** `storage.memory_limit` (default `512MB`) is divided across `max_indexes` slots, counting unused ones, and it does not cap the process RSS, so leave headroom. Compose sets no CPU or memory limit.
- **Request budgets.** Raw body admission (16 MiB) and decoded admission (64 MiB) limit memory held by HTTP request bodies, not total memory. See [limits and errors](https://sandrinodm.github.io/logbrook/operate/limits-and-errors/).
- **Each index adds threads.** Reader workers and DuckDB threads apply per index. Set `max_indexes = 1` for a single-index deployment, or raise the total budgets when you add slots.
- **Disk.** The disk target (`max_size_gb`) is a retention target, not a hard limit. Transactions, exports, compaction and query spills can briefly exceed it. Watch free disk separately, and use a filesystem quota if you need a hard ceiling. `/ready` does not warn about low disk space.
- **Load tests.** The repository has load generators under `cargo xtask`; see [Contributing](https://sandrinodm.github.io/logbrook/project/contributing/).

## Production checklist

- [ ] Image pinned to a version tag or digest.
- [ ] Ingest, read and admin tokens are random, 16 to 512 characters and distinct from each other. See [credentials](https://sandrinodm.github.io/logbrook/configure/credentials/).
- [ ] Producer and reader tokens are scoped to the sources and indexes they need.
- [ ] Container runs read-only, with dropped capabilities and a 35 second stop timeout.
- [ ] `/data` is on a persistent volume with a single owner process, owned by UID `10001`.
- [ ] Port 3100 is not exposed directly; a TLS-terminating proxy handles remote access.
- [ ] If you run the [web UI](https://sandrinodm.github.io/logbrook/web-ui/), it is behind an authenticating reverse proxy, or bound to loopback.
- [ ] Retention, archive age and disk target are set for each index. See [indexes and retention](https://sandrinodm.github.io/logbrook/configure/indexes-and-retention/).
- [ ] Prometheus scrapes `/metrics` and you alert on free disk. See [monitoring](https://sandrinodm.github.io/logbrook/operate/monitoring/).
- [ ] You have taken and restored a backup at least once. See [backup and upgrade](https://sandrinodm.github.io/logbrook/operate/backup-and-upgrade/).
- [ ] Producers retry `429` with backoff, and you accept that a retried ingestion can store duplicates.

## Next steps

- [Limits and errors](https://sandrinodm.github.io/logbrook/operate/limits-and-errors/) — Every default limit and error response.
- [Monitoring](https://sandrinodm.github.io/logbrook/operate/monitoring/) — Health, readiness and Prometheus metrics.
- [Backup and upgrade](https://sandrinodm.github.io/logbrook/operate/backup-and-upgrade/) — Back up, restore and move between releases.

Source: https://sandrinodm.github.io/logbrook/operate/production/index.mdx
