The commands on this page open the data directory directly, so stop the server first: only one process may use a data root at a time. They read the same configuration as the server (--config and the supported LOGBROOK_* environment variables) and take --index <name>, which defaults to default.
Archive events offline
The server archives hot events on its own after archive_after_ms. To do it by hand, stop the service and run:
logbrook --config logbrook.local.toml archive --before 1791321600000--before is an exclusive Unix-millisecond cutoff and must not be negative. The command archives in batches until nothing older than the cutoff remains, then prints the total:
{ "archived": 12345 }Archiving does not delete anything. Archived events stay searchable, and they expire with retention like other events.
For a specific index:
logbrook --config logbrook.local.toml --index payments archive --before 1791321600000Promoted string attributes
If you filter often on a few top-level string attributes, configure up to eight physical columns for them:
[storage]
promoted_string_keys = ["runId", "actorJobId", "videoId"]indexes.<name>.promoted_string_keys overrides the global list for one index. Each key is 1 to 256 UTF-8 bytes, and the keys must be distinct.
What changes:
- Only string equality filters on those keys get faster. Numeric and boolean filters and other keys use the JSON path as before.
- Query results, live tail, authorization and cursors behave the same.
- Existing hot rows are not covered and keep using JSON filtering. New rows get the columns. Export and compaction backfill older data over time.
- Archive files above the compaction byte limit, and rows with malformed JSON, stay on the JSON path.
- Missing, null and non-string values are stored as NULL, which is distinct from uncovered rows.
Activation is permanent
An index is activated the first time it opens with a non-empty key set, and activation upgrades it to schema version 4. From then on its keys are fixed.
- The same keys in a different order are accepted.
- Omitting the setting, or setting
[], keeps the recorded keys rather than removing them. - A different non-empty set is rejected at startup.
- To change the keys, create a new index and reimport.
- An empty per-index override stops inheritance of the global list only for an index that is not activated yet.
Promoted archives carry SHA-256 digests, checked at startup and around query and compaction reads. Never modify archive files in place: a mismatch fails the operation and can mark the index unready. The digests catch accidental changes, not someone who can also rewrite the database and its manifest, and hashing adds some CPU cost to writes and archive reads.
Check coverage
With the server stopped, inspect an index:
logbrook --config logbrook.local.toml --index payments projection-statusThe command prints one line of JSON with these fields:
| Field | Meaning |
|---|---|
schema_version |
Schema version of the index (3 or 4) |
promoted_string_keys |
The recorded key set |
hot_rows |
Rows in the hot database |
hot_covered_rows |
Hot rows that have the promoted columns |
archived_rows |
Rows in Parquet archives |
archived_covered_rows |
Archived rows that have the promoted columns |
legacy_archive_files |
Archive files written before schema version 4 |
projection-status verifies the archives it reads, uses the normal query deadline, and has no HTTP equivalent. With a non-empty key set configured, it activates an index that is not activated yet, so take a backup first.
Migrate an older flat data directory
Logbrook refuses to start on the old flat layout, <data_dir>/events.duckdb, rather than create an empty default index next to it.
Stop the old process and back up
Take a complete offline backup of the data directory.
Create the default index directory
mkdir -p "$DATA_DIR/indexes/default"Move the files together
Move
events.duckdb,events.duckdb.walif it exists,archives/andtemp/(if present) intoindexes/default/in one step.cd "$DATA_DIR" mv events.duckdb archives indexes/default/ [ -e temp ] && mv temp indexes/default/ [ -e events.duckdb.wal ] && mv events.duckdb.wal indexes/default/Do not change the archive paths stored in the database.
Restart and verify
Start with the data root still set to
$DATA_DIR, then check event counts.
To roll back, restore the backup together with the previous binary.