Skip to content

Archives, retention and backups

How events move from DuckDB to Parquet, when retention deletes them, and what a backup is.

Updated

Each index keeps recent events in DuckDB and moves older ones into Parquet files. Events leave an index when they pass its retention period or when the index reaches its disk-size target.

The lifecycle of an event

Every index runs a maintenance pass at startup and then every maintenance_interval_secs (60 seconds by default). A pass runs these jobs in order:

Job What it does
Retain Expires events older than the retention window.
Enforce size When the index has a disk-size target and is over it, expires the oldest events. It runs again at the end of the pass.
Archive Moves hot events older than archive_after_ms from DuckDB into Parquet files. Archiving does not delete anything.
Compact Merges small Parquet files in the same time partition into larger ones.

All of these work on event time. By default an event stays in DuckDB for about a day, then lives in an archive until retention expires it.

Archives

An archive is a Parquet file of older events. Archived events stay searchable: a query reads the hot rows and the relevant Parquet files together. See search and live tail.

Archives are partitioned by event time, one hour per partition by default (storage.archive_partition_ms). A manifest inside the index database records each archive’s time range and size. Manifest paths are relative to the data directory, so you can move a complete data directory.

Archive files live in the index’s archives/ directory. Keep other files out of it: at startup, Logbrook removes .tmp files and any .parquet file the manifest doesn’t reference. A missing archive file, or one with an unexpected size, is an integrity failure that makes the server unready.

Retention

Retention is how long an index keeps events, measured against event time. The default is 7 days, and you can override it per index.

Expiry and file deletion are separate:

  • An expired event disappears from queries immediately.
  • An archive file is deleted only when every event in it has expired. A partly expired file stays on disk and is not rewritten.
  • The expiry cutoff is stored and only moves forward. Live ingestion rejects events older than it.

Retention must be longer than the archive age. For one-day retention, also shorten archive_after_ms, for example to one hour.

Changing retention

A policy change takes effect on the first maintenance pass after a restart.

  • A shorter retention can expire existing events on that pass.
  • A longer retention never restores events that already expired, so lengthen it before you need it.

Disk-size targets

An index can also have a disk-size target. When the index reaches it, Logbrook expires the oldest events before they reach the age limit.

The target is measured, not reserved. It counts the database, the write-ahead log, archive files (including ones that running queries still hold), spill files and other files Logbrook owns in the index directory.

When an index is at or over its target, maintenance:

  1. Reclaims space from the write-ahead log.
  2. Expires the oldest archives, once queries have released them.
  3. Expires hot rows if no archives remain.

While the index is at its target, ingestion returns 507. Writes resume once space is reclaimed, or after you raise the target and restart.

Both limits apply per index: a 20 GB target gives each index its own 20 GB, not a share of it.

Backups

A backup is a copy of the whole data directory, taken while the server is stopped. It must include:

  • the DuckDB files and any write-ahead log
  • the archive manifest, which lives inside the DuckDB database
  • all Parquet archive files

Neither the archive files nor the database alone hold all retained data. Don’t copy a live data directory with a plain recursive copy, and don’t treat .index-trash/ as a backup. See Back up and upgrade for the procedure.

Next steps

Type to search…

↑↓ navigate↵ selectEsc close