---
title: "Configuration file"
description: "Every section and key of the Logbrook TOML configuration file."
---

> 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.

# Configuration file

Logbrook reads one TOML file and a fixed set of `LOGBROOK_*` environment variables, once, at startup. Restart the server to apply a change.

## How configuration loads

Settings resolve in this order, and later steps win:

1. Built-in defaults.
2. The TOML file, if you pass one.
3. The supported `LOGBROOK_*` environment variables.

Pass the file with the global `--config` flag. There is no environment variable for the file path and no default search path.

```sh
logbrook --config logbrook.toml check-config
logbrook --config logbrook.toml serve
```

Without `--config`, Logbrook runs on defaults and the environment. It still needs an ingestion token and a read token, so set `LOGBROOK_INGEST_TOKEN` and `LOGBROOK_READ_TOKEN`.

- Unknown keys are rejected in every table.
- Remote commands such as `logbrook query` and `logbrook indexes` don't read the file. They reject `--config` and take `--url` and token variables instead. See the [CLI reference](https://sandrinodm.github.io/logbrook/reference/cli/).
- `logbrook healthcheck` reads only `bind` from the file, plus `LOGBROOK_BIND`.
- Only the variables listed [below](#environment-variables) work. There is no generic `LOGBROOK_<SETTING>` mapping and no `_FILE` variant for secrets.
- An empty environment variable counts as set. Integer overrides reject empty, zero and negative values, and token overrides reject empty credentials.

### Validate before you start

`check-config` validates the configuration without opening the data directory.

```sh
logbrook --config logbrook.toml check-config
```

```text
Configuration is valid
```

Start from the [example file](https://github.com/sandrinodm/logbrook/blob/main/logbrook.example.toml). Its placeholder tokens begin with `replace-with-` and fail validation until you replace them.

> **Keep real credentials out of Git**
>
> The repository ignores files named `*.local.toml`. Name your copy `logbrook.local.toml`.

## Top-level keys

These keys sit before any `[table]` header.

### Server

| Key | Type | Default | Meaning |
| --- | --- | --- | --- |
| `bind` | string | `"127.0.0.1:3100"` | HTTP listen address, as `IP:port`. IPv6 uses `"[::1]:3100"`. Env: `LOGBROOK_BIND`. |
| `max_connections` | integer | `128` | Concurrent HTTP connections. Range 1 to 65536. |
| `header_timeout_ms` | integer | `10000` | Time to receive request headers. Range 1 to 300000. |
| `shutdown_timeout_secs` | integer | `30` | Time to drain listeners, sessions and storage on shutdown. Positive. |
| `maintenance_interval_secs` | integer | `60` | Delay between retention, archive and compaction passes. Positive. Env: `LOGBROOK_MAINTENANCE_INTERVAL_SECS`. |

Logbrook serves plain HTTP. Put a reverse proxy in front for TLS.

### Credentials

| Key | Type | Default | Meaning |
| --- | --- | --- | --- |
| `admin_tokens` | array of strings | `[]` | Optional admin credentials. Env: `LOGBROOK_ADMIN_TOKEN` replaces the whole list with one token. |

Ingestion and read tokens are [tables](#ingest_tokens). [Credentials and roles](https://sandrinodm.github.io/logbrook/configure/credentials/) explains the roles.

### Indexes and retention

| Key | Type | Default | Meaning |
| --- | --- | --- | --- |
| `max_indexes` | integer | `4` | Maximum indexes, including `default`. Range 1 to 64. Env: `LOGBROOK_MAX_INDEXES`. |
| `archive_after_ms` | integer | `86400000` | Event age before archival to Parquet. Positive, and shorter than retention. Env: `LOGBROOK_ARCHIVE_AFTER_MS`. |
| `retention_days` | integer | unset | Retention in whole days. Wins over `retention_ms` if both are set in the file. Env: `LOGBROOK_RETENTION_DAYS`. |
| `retention_ms` | integer | `604800000` (7 days) | Retention in milliseconds. Must exceed `archive_after_ms`. Env: `LOGBROOK_RETENTION_MS`. |
| `max_size_gb` | integer | unset | Per-index disk target in decimal GB (1 GB = 1,000,000,000 bytes). Wins over `storage.max_size_bytes` if both are set. Env: `LOGBROOK_MAX_SIZE_GB`. |

Every index inherits these values. [Indexes and retention](https://sandrinodm.github.io/logbrook/configure/indexes-and-retention/) covers the behavior and per-index overrides.

### Ingestion limits

| Key | Type | Default | Range and meaning |
| --- | --- | --- | --- |
| `max_body_bytes` | integer | `1048576` (1 MiB) | 1 to 16777216. Largest ingestion request body. |
| `max_event_bytes` | integer | `65536` (64 KiB) | Positive, at most `max_body_bytes`. Largest serialized event. |
| `max_events` | integer | `1000` | 1 to 10000. Events per request. |
| `max_metadata_depth` | integer | `16` | 1 to 64. Nesting depth of attributes. |
| `max_field_bytes` | integer | `4096` | Positive, at most `max_event_bytes`. Size of string fields, attribute keys and string values, and of supported filter fields. |
| `max_inflight_requests` | integer | `16` | 1 to 1024. Concurrently admitted HTTP requests, process-wide. Live-tail streams are budgeted separately. |
| `max_inflight_body_bytes` | integer | `16777216` (16 MiB) | At least `2 * max_body_bytes`, at most 4294967295. Process-wide budget for raw bodies. When it is used up, ingestion is rejected as overload. |
| `max_decoded_bytes` | integer | `67108864` (64 MiB) | At least `max_event_bytes`, at most 4294967295. Process-wide estimate of decoded allocations. |
| `body_idle_timeout_ms` | integer | `5000` | Positive, at most `body_total_timeout_ms`. Longest wait between body frames. |
| `body_total_timeout_ms` | integer | `30000` | At least `body_idle_timeout_ms`, at most 300000. Total time to receive a body. |
| `max_future_skew_ms` | integer | `300000` | 0 to 86400000. How far ahead of server time an event timestamp may be. |

These budgets bound the memory held by request bodies, not process memory. Leave headroom for DuckDB.

### Query and tail limits

| Key | Type | Default | Range and meaning |
| --- | --- | --- | --- |
| `max_query_range_ms` | integer | `2678400000` (31 days) | Positive, at most 366 days. Longest time span of one query. |
| `max_page_size` | integer | `1000` | 1 to 1000. Largest page of search results. |
| `max_tail_subscribers` | integer | `8` | 1 to 1024. Concurrent live-tail streams. |
| `max_tail_buffer_bytes` | integer | `1048576` (1 MiB) | 1024 to 67108864, and at least `2 * max_event_bytes + 1024`. Buffered output per tail subscriber. |
| `tail_poll_ms` | integer | `1000` | At least 250. Fallback wait between tail polls. Commits wake a caught-up stream immediately. |

## `[storage]`

These settings apply to every index. `memory_limit`, `temp_limit` and `queue_bytes` are process-wide budgets divided evenly across the `max_indexes` slots, including unused ones.

| Key | Type | Default | Range and meaning |
| --- | --- | --- | --- |
| `data_dir` | string | `"data"` | Root directory. Index data lives in `<data_dir>/indexes/<name>`. Relative paths resolve from the working directory. Must be UTF-8 and cannot contain `*`, `?`, `[` or `]`. Env: `LOGBROOK_DATA_DIR`. |
| `reader_threads` | integer | `2` | 1 to 16. Read workers per index. |
| `duckdb_threads` | integer | `2` | 1 to 64. DuckDB execution threads per connection. |
| `memory_limit` | string | `"512MB"` | Shared DuckDB memory budget. Positive integer plus `KB`, `MB` or `GB` (decimal units, no spaces, number up to 1,000,000). Not a process memory cap. |
| `temp_limit` | string | `"2GB"` | Shared DuckDB spill budget, with the same syntax. |
| `queue_capacity` | integer | `16` | 1 to 1024. Jobs in each index's writer, reader and maintenance queues. |
| `queue_bytes` | integer | `33554432` (32 MiB) | 1024 to 4294967295. Shared byte budget for queued ingestion. Each slot needs at least 1024 bytes after division. |
| `query_timeout_ms` | integer | `5000` | 1 to 300000. Maximum duration of one query. |
| `max_query_bytes` | integer | `8388608` (8 MiB) | 1024 to 67108864. Maximum materialized result size. |
| `archive_batch_rows` | integer | `100000` | 1 to 1000000. Rows archived in one batch. |
| `archive_partition_ms` | integer | `3600000` (1 hour) | 1 to 86400000. Width of a Parquet time partition. |
| `compact_max_files` | integer | `16` | 2 to 256. Parquet files selected for one compaction. |
| `compact_max_bytes` | integer | `134217728` (128 MiB) | 1024 to 8589934592. Combined input size of one compaction. |
| `maintenance_timeout_ms` | integer | `30000` | 1 to 300000. Longest single maintenance operation. |
| `max_size_bytes` | integer | unset | Per-index disk target in bytes, at least 16777216 (16 MiB). Env: `LOGBROOK_MAX_SIZE_BYTES`. |
| `promoted_string_keys` | array of strings | `[]` | Up to eight distinct top-level string attributes, each 1 to 256 bytes, stored in typed columns to speed up equality filters. |

> **promoted\_string\_keys is permanent for an index**
>
> The first time an index opens with a non-empty key set, it records the keys and upgrades its schema to version 4. Removing the setting later doesn't remove the keys, and a different non-empty set is rejected at startup. To change the keys, create a new index and reimport. Take an offline backup before you turn this on.

## `[ingest_tokens]`

Maps each ingestion token to the source name it stamps on events. You need at least one entry.

```toml title="logbrook.toml"
[ingest_tokens]
"your-ingest-token" = "checkout-prod"
```

Source names have 1 to 128 ASCII letters, digits, hyphens, underscores or periods. Env: `LOGBROOK_INGEST_TOKEN` replaces the entire table with one token, whose source is `LOGBROOK_SOURCE` (default `default`).

## `[read_tokens]`

Maps each read token to the list of sources it may read. An empty list grants every source. You need at least one entry.

```toml title="logbrook.toml"
[read_tokens]
"your-read-token" = []
"your-checkout-token" = ["checkout-prod"]
```

Env: `LOGBROOK_READ_TOKEN` adds or replaces one entry without clearing the others. See [credentials and roles](https://sandrinodm.github.io/logbrook/configure/credentials/) for how `LOGBROOK_READ_SOURCES` interacts with it.

## `[ingest_index_scopes]` and `[read_index_scopes]`

Optional tables that limit a token to named indexes. Each key must match a configured token of the same kind. A missing entry or an empty list grants every index.

```toml title="logbrook.toml"
[ingest_index_scopes]
"your-ingest-token" = ["payments"]

[read_index_scopes]
"your-read-token" = ["payments", "audit"]
```

These tables are TOML-only. Source limits still apply on top of them.

## `[indexes.<name>]`

Each table declares an index, creates it at startup, and can override the inherited policy. Names have 1 to 63 lowercase ASCII letters, digits, hyphens or underscores, and start with a letter or digit.

| Key | Type | Meaning |
| --- | --- | --- |
| `retention_days` | integer | Retention in days for this index. Use this or `retention_ms`, not both. |
| `retention_ms` | integer | Retention in milliseconds. Must exceed this index's archive age. |
| `archive_after_ms` | integer | Archive age for this index. Positive, and shorter than retention. |
| `max_size_gb` | integer | Disk target in decimal GB. Use this or `max_size_bytes`, not both. |
| `max_size_bytes` | integer | Disk target in bytes, at least 16777216. |
| `promoted_string_keys` | array of strings | Overrides `storage.promoted_string_keys` for this index. |

Omitted keys inherit the resolved top-level value. The `default` index always exists and needs no table unless you want to override its policy.

## `[forward]`

The optional Fluent Forward receiver. It is TOML-only and off by default (`enabled = false`). Enabling it requires `storage.queue_capacity` of at least 2, and HTTP credentials are still required. See [Forward listener](https://sandrinodm.github.io/logbrook/configure/forward-listener/) for its keys.

## Environment variables

The server reads only these variables. An unset variable leaves the file value or default in place.

| Variable | Overrides | Notes |
| --- | --- | --- |
| `LOGBROOK_BIND` | `bind` | Must be `IP:port`. |
| `LOGBROOK_DATA_DIR` | `storage.data_dir` | The container image sets it to `/data`. |
| `LOGBROOK_INGEST_TOKEN` | `[ingest_tokens]` | Replaces the whole table. |
| `LOGBROOK_SOURCE` | the source of the env ingest token | Default `default`. No effect without `LOGBROOK_INGEST_TOKEN`. |
| `LOGBROOK_READ_TOKEN` | `[read_tokens]` | Adds or replaces one entry. |
| `LOGBROOK_READ_SOURCES` | sources of the env read token | Comma-separated. Empty grants all sources. No effect without `LOGBROOK_READ_TOKEN`. |
| `LOGBROOK_ADMIN_TOKEN` | `admin_tokens` | Replaces the whole list with one token. |
| `LOGBROOK_RETENTION_DAYS` | `retention_days` | Positive integer. Do not set with `LOGBROOK_RETENTION_MS`. |
| `LOGBROOK_RETENTION_MS` | `retention_ms` | Clears the days alias. |
| `LOGBROOK_MAX_SIZE_GB` | `max_size_gb` | Positive integer. Do not set with `LOGBROOK_MAX_SIZE_BYTES`. |
| `LOGBROOK_MAX_SIZE_BYTES` | `storage.max_size_bytes` | Clears the GB alias. |
| `LOGBROOK_MAX_INDEXES` | `max_indexes` | Positive integer. |
| `LOGBROOK_INDEXES` | `[indexes.*]` | Comma-separated names to create. Existing tables keep their policies. Whitespace is not trimmed. |
| `LOGBROOK_ARCHIVE_AFTER_MS` | `archive_after_ms` | Positive integer. |
| `LOGBROOK_MAINTENANCE_INTERVAL_SECS` | `maintenance_interval_secs` | Positive integer. |

Numeric values are base-10 integers without units. Environment policy values replace the global defaults, but an explicit `[indexes.<name>]` setting still wins.

> **Client variables are separate**
>
> The remote CLI commands read `LOGBROOK_URL`, `LOGBROOK_TOKEN` and the role tokens. See the [CLI reference](https://sandrinodm.github.io/logbrook/reference/cli/).

## Validation errors

`serve` and `check-config` fail with one of these messages. The server exits with a nonzero status and logs the error as JSON on stderr.

| Message | Cause |
| --- | --- |
| `invalid TOML config at line N, column M; check syntax, setting names, and value types` | Syntax error, unknown key or wrong type. Only the location is reported, so credentials in the file aren't echoed. |
| `cannot read config: ...` | The file is missing or unreadable. |
| `configure at least one ingest token and one read token ...` | `[ingest_tokens]` or `[read_tokens]` is empty. |
| `tokens must contain 16–512 visible ASCII characters without whitespace; replace example credentials` | A token is the wrong length, has other characters, or starts with `replace-with-`. |
| `use separate credentials for ingestion and reading` | One token is in both tables. |
| `use separate credentials for administration, ingestion and reading` | An admin token duplicates another role's token. |
| `source names must contain 1–128 ASCII letters, digits, '-', '_' or '.'` | Invalid source name. |
| `index names must contain 1–63 lowercase ASCII letters, digits, '-' or '_', starting with a letter or digit` | Invalid index name. |
| `configured indexes, including default, exceed max_indexes` | More `[indexes.*]` tables than slots. |
| `max_indexes must be between 1 and 64` | Index limit out of range. |
| `retention_ms must be greater than archive_after_ms` | Retention is not longer than the archive age. |
| `max_size_bytes must be at least 16 MiB (16777216 bytes)` | Disk target too small. |
| `index policy must use retention_days or retention_ms, not both` | Both units in one `[indexes.*]` table. The same rule exists for `max_size_gb` and `max_size_bytes`. |
| `index scope refers to an unconfigured token` | A scope table names a token that is not in the matching token table. |
| `invalid HTTP limits: ...` | A request, body, memory, timeout, tail or query limit is out of range or inconsistent. |
| `invalid storage budgets; ...` | A `[storage]` value is out of range, or a size is not a positive integer with `KB`, `MB` or `GB`. |
| `storage.queue_bytes must provide at least 1024 bytes per index slot` | `queue_bytes` divided by `max_indexes` is too small. |
| `storage budgets must provide at least 1KB per index slot` | `memory_limit` or `temp_limit` divided by `max_indexes` is under 1 KB. |
| `LOGBROOK_X must be greater than zero` | A numeric environment override is zero or negative. |
| `set only one of LOGBROOK_RETENTION_DAYS and LOGBROOK_RETENTION_MS` | Both retention variables are set. The same applies to the size variables. |
| `LOGBROOK_READ_SOURCES must explicitly set the scope ...` | An env read token was added to a file that already defines read tokens. |
| `paths must not contain DuckDB glob characters: *, ?, [, ]` | `data_dir` contains a glob character. |

## Next steps

- [Credentials and roles](https://sandrinodm.github.io/logbrook/configure/credentials/) — Set up ingestion, read and admin tokens.
- [Indexes and retention](https://sandrinodm.github.io/logbrook/configure/indexes-and-retention/) — Limits, retention and disk-size targets.
- [Run in production](https://sandrinodm.github.io/logbrook/operate/production/) — Sizing, TLS and deployment guidance.

Source: https://sandrinodm.github.io/logbrook/configure/configuration-file/index.mdx
