Log storage¶
Runner output is captured by the log worker, not read from pods on demand, so output survives pod cleanup. Where it is kept long-term depends on logStorage.backend.
| Backend | Recent output | Older output | Fits |
|---|---|---|---|
database (default) |
PostgreSQL | PostgreSQL | Small installations, modest output |
s3 branch codex/highload-s3 |
PostgreSQL (hot tail) | S3-compatible bucket, gzip chunks | Many hosts, long playbooks, long retention |
With database, every output line is a PostgreSQL row with its index entries and WAL. A rough feel for scale: 5,000 hosts × 100 task results × 100 runs × 1 KiB is about 48 GiB a day before indexes and replication. Long before that, use S3.
How capture works¶
- When a runner starts, its output stream is registered in PostgreSQL.
- A log worker leases the stream (renewed every 20 seconds, expires after 90) and reads the pod's log through the Kubernetes API in 64 KiB chunks.
- Lines are written to PostgreSQL in order, with the pod's timestamps, so a restart resumes exactly where it stopped without duplicates.
- With
s3, everything except the most recenthotLines(default 1024) lines is compressed into gzip chunks, uploaded, and only after a successful upload published in a manifest while the hot rows are deleted — in one transaction. - The UI and API read hot rows and archived chunks through one cursor; you cannot tell which tier a line came from.
If a log worker dies, another one takes the lease after it expires and continues from the saved offsets. If the bucket is unavailable, hot rows simply stay in PostgreSQL and upload is retried later. Reads verify each chunk's SHA-256 and refuse chunks larger than 8 MiB uncompressed.
Limits: one output record is capped at 256 KiB and marked as truncated beyond that. Output that Kubernetes rotated away or lost with a node before the worker read it cannot be recovered; keep log workers healthy and scaled.
Enable S3¶
- Create the bucket — Liftway does not create or administer buckets. Enable server-side encryption and, if your provider supports it, versioning.
-
Create credentials limited to the application's prefix:
-
Store them in a Secret in Liftway's namespace, keys
access-keyandsecret-key(or setaccessKeyKey/secretKeyKeyto your names). An ExternalSecret from Vault works well. -
Set values and upgrade:
-
Allow egress from controller and log-worker pods to the endpoint on 443. Runner pods never receive these credentials and need no access.
Both the controller (for reading) and every log worker (for writing) use the same bucket, prefix and Secret. Restart both after rotating the S3 credentials — they are read from environment variables at start.
Retention and garbage collection¶
Archived chunks belong to runs. When history retention deletes a run, its object keys go into a queue in PostgreSQL and are deleted from the bucket with retries. Objects that no manifest references (for example, uploaded just before a crash) are removed after 24 hours.
Do not add a bucket lifecycle rule that expires objects Liftway still references — the run would show gaps. If you need a hard maximum age, set history retention shorter than that rule.
Backups and consistency¶
PostgreSQL holds the manifests; the bucket holds the content. Back them up together, and restore them to the same point in time. A database restored to an older point than the bucket only wastes space; a bucket older than the database loses output.
Switching backends¶
- database → s3: new output and the output of earlier, already finished runs is archived to the bucket in the background; until then it is read from PostgreSQL as before.
- s3 → database, or another bucket: existing chunks are not migrated. Keep the old bucket readable, or the archived parts of old runs disappear.
- Rolling back to a version without S3 support after logs were archived needs an S3-aware reader, or a tested restore of both database and bucket.
Sizing log workers¶
Each worker follows up to logWorker.capacity streams (default 100) with logWorker.poolSize database connections (default 8). Run at least two workers so that a rollout or node loss does not pause capture. Scale on CPU and on capture lag; in a load test one worker reached its 1-core limit while capturing hundreds of thousands of lines. Ingest still flows through PostgreSQL, so watch database IOPS and WAL growth.