Most setups don’t need this: every release publishes a container image, which the quickstart and Docker Compose pages use. Build from source to run an unreleased commit, a platform without an image, or the binary without Docker.
Build the logbrook executable from a checkout, run it on 127.0.0.1:3100, send an event, and search it. Run every command from the repository root.
Prerequisites
- Rust, installed with rustup. The repository pins Rust 1.99.1 in
rust-toolchain.toml, and rustup installs that version on your firstcargocommand. - A C++ compiler for the bundled DuckDB build. On macOS, install the Xcode command-line tools with
xcode-select --install. opensslandcurlfor the commands below.
If cargo is not found right after installing Rust, run . "$HOME/.cargo/env" or open a new shell.
Build and run
Clone and build
git clone https://github.com/sandrinodm/logbrook.git cd logbrook cargo build --package logbrook --locked --releaseThe first build compiles DuckDB from source and takes several minutes.
Start the server
Generate the two credentials, print them for the second terminal, validate the configuration, and start the server.
export LOGBROOK_INGEST_TOKEN="$(openssl rand -hex 24)" export LOGBROOK_READ_TOKEN="$(openssl rand -hex 24)" echo "Ingest token: $LOGBROOK_INGEST_TOKEN" echo "Read token: $LOGBROOK_READ_TOKEN" target/release/logbrook check-config target/release/logbrook serveservestays in the foreground and writes JSON logs to stderr. Press Ctrl-C to stop it. Without a configuration file, Logbrook listens on127.0.0.1:3100, stores data in./data, and keeps events for seven days with no disk-size target.Send an event
In a second terminal in the repository root, set the ingestion token and send one event to an index named
payments.export LOGBROOK_INGEST_TOKEN='<ingest token from the first terminal>' curl --fail http://127.0.0.1:3100/indexes/payments/logs/ingest \ -H "Authorization: Bearer $LOGBROOK_INGEST_TOKEN" \ -H 'Content-Type: application/json' \ --data "[{ \"time\": $(( $(date +%s) * 1000 )), \"level\": 30, \"service\": \"checkout\", \"msg\": \"Order accepted\", \"orderId\": \"demo-1\" }]"{ "accepted": 1 }The first authorized write to a new index creates it.
Search
Set the read token, then query the index with the CLI:
export LOGBROOK_READ_TOKEN='<read token from the first terminal>' target/release/logbrook query payments --since 1hAdd
--jsonto see the complete record, including theorderIdattribute.
Use a configuration file
Settings resolve in this order: built-in defaults, then an optional TOML file passed with --config, then supported LOGBROOK_* environment variables.
cp logbrook.example.toml logbrook.local.toml
# Edit logbrook.local.toml and replace every replace-with-... credential.
target/release/logbrook --config logbrook.local.toml check-config
target/release/logbrook --config logbrook.local.toml serveGit ignores *.local.toml files. Environment variables override the file, so unset the token variables from the steps above to use the file’s credentials. See the configuration file.