carlos / platform Public

Configurable log retention, archive and fast search for self-hosters open

Problem

A self-hosted operator (Tito) investigating a spam submission found only a few hours of history. Two limits cause it:

  • carlos logs retention is hard-coded: 7 days or 50 MiB per app per box, whichever first (internal/host/logship.go:32-33, logshipMaxAge / logshipMaxBytes). A busy app hits the byte cap in hours. No operator knob exists.
  • Edge request records ride the same applog.Sink (internal/host/reqrec_loop.go), so they eat the same 50 MiB. They are also sampled, so a given POST may never be recorded.
  • Box journald is unconfigured (distro defaults) and is not the product's log store anyway.

Search reads the whole window and filters console-side (internal/applog/filter.go): fine for hours, slow for 90 days.

Direction (no ELK)

We already have a Loki-shaped store: immutable gzipped hourly chunks in the operator's own bucket. Extend it rather than adopt ELK (JVM cluster, hard tenancy, cost, against provider-neutral core).

  1. Operator retention knobs (slice 1, small). CARLOS_LOG_RETENTION_DAYS and a per-app-per-box byte cap the operator can raise or disable, plus a separate budget for edge request records so they stop crowding app logs. Same pattern as CARLOS_ANALYTICS_RETENTION_DAYS (a3c407d4); console config (#453) is the better long-term home. Defaults unchanged.
  2. Archive tier: lifecycle older hours to IA/Glacier in the operator's bucket instead of deleting; operator picks archive length.
  3. Hourly compaction + sidecar index (token bloom filters; exact keys for request ID, path, client hash) so long-window search skips hours that cannot match. Built at write time; no new per-box S3 polling.
  4. Drains (OTLP / syslog / S3 export) per fleet, so operators with Loki/ELK/Datadog keep their own long-term copy.
  5. Carloku: plans choose values inside the operator ceiling (e.g. Free 24 h, Personal 7 d, paid 30-90 d, enterprise 1 y).
  6. Platform audit log: append-only, 1 y, console actions, deploys, operator/root access, auth.

ISO 27001 note

Annex A 8.15 (logging), 8.16 (monitoring), 8.17 (clock sync). No fixed retention period: the operator sets it in policy against its risk assessment (90 d to 1 y is the norm; PCI DSS wants 1 y with 3 months hot). The obligation is the operator's for its own platform logs; our job is to make it possible: configurable retention, tamper protection, audit log, export. GDPR pulls the other way: logs with IPs are personal data, so state retention and minimise.

Interim for Tito

Raise journald limits on its boxes (SystemMaxUse, MaxRetentionSec) for box-level history; have the app log one structured line per form submission carrying the request ID. The 50 MiB carlos logs cap needs slice 1.

Slice 1 MERGED as 5dce1a3 (2026-11-14), not released: CARLOSLOGRETENTIONDAYS / CARLOSLOGRETENTIONMB (or off) in host.env, defaults 7 days / 50 MiB; prune no longer LISTs every kept hour. Tito needs a release, a roll, then the two settings in each box's host.env. Next slices: separate budget for edge request records (own chunk family), archive tier, index for long-window search, drains.

Slice 1 is in v0.35.4 and LIVE on dev (2026-11-14). The v0.35.4 release agent saw the expected agent line on sophie at 17:36:07Z (bucket) and on demo box-1 at 17:38:27Z (fleet store door): logship loop armed ... keeping 7 days, 50 MiB per app. Both are on defaults. Flagship follows tonight (8a3d302). Tito's infra session (09cca11) sets CARLOSLOGRETENTIONDAYS / MB in each box's host.env when it upgrades Tito to v0.35.4. The other items stay open here until someone needs them.