Skip to content

v2.15.0: Log archiving and cron/log reliability fixes

Choose a tag to compare

@jdx jdx released this 01 Jul 22:17
· 190 commits to main since this release
Immutable release. Only release title and notes can be modified.
c8469ac

A small feature release adding a log archive hook so retention no longer means data loss, plus fixes for config-only cron daemons, trailing log lines at daemon exit, and startup log streaming.

Added

  • Log archive hook (#534) — @gaojunran. Before retention prunes old log entries, pitchfork can now hand them off to a user-defined command. The hook receives entries as JSON Lines on stdin (fields: id, daemon_id, timestamp, message), plus PITCHFORK_DAEMON_ID and PITCHFORK_ARCHIVE_REASON (age or count) in the environment. If the hook exits non-zero, the batch is not deleted, so a failed archive destination won't cause data loss.

    Configure globally in settings.toml:

    [logs.archive_hook]
    command = "gzip -c >> /var/log/pitchfork/archive.jsonl.gz"
    batch_size = 1000

    Or per-daemon in pitchfork.toml:

    [daemons.api]
    archive_hook = "aws s3 cp - s3://my-bucket/pitchfork-logs/"

Fixed

  • Config-only cron daemons now fire without boot_start (#548, closes #542) — @gaojunran. Previously, a daemon defined in pitchfork.toml with cron = "..." but no boot_start never triggered, because the cron watcher only iterated daemons already in state. The watcher now auto-registers config-only cron daemons at the start of each tick, pitchfork status falls back to config and reports them as available instead of "not found", proxy list matches, and pitchfork clean preserves entries that have a cron_schedule. The /stats web API also gains an available count.

  • Trailing log lines no longer lost at daemon exit (#540, closes #537) — @gaojunran. The supervisor's select! loop used to break immediately when the daemon exited, dropping anything still queued in the mpsc channel or OS pipe buffer. There's now a bounded (5s) post-loop drain that flushes remaining output to the log store before state cleanup.

  • Startup log streaming no longer replays old logs (#560) — @gaojunran. stream_startup_logs mixed timestamp-based initial fetch with id-based polling, and the timestamp was captured before IPC started, so last_id stayed at 0 and the next tail(0) returned the entire log history. Both paths now anchor on the daemon's current max row id.

  • Dependency updates: tower-http 0.7 (#558), cron 0.17 (#556), itertools 0.15 (#557).

Documentation

  • $PORTN env vars and template scoping (#563, closes #562) — @gaojunran. Documented $PORT0, $PORT1, … which expose all resolved ports (not just the first, via $PORT) to a daemon, and corrected the note that suggested {{ daemons.xxx.port }} for a daemon's own ports — templates can only reference dependency ports; use the env vars for your own.

Full Changelog: v2.14.0...v2.15.0

💚 Sponsor pitchfork

pitchfork is built by @jdx, who ships developer tools like mise, hk, pitchfork, and more. Development is sustained by sponsorships.

If pitchfork has a place in your dev workflow, please consider sponsoring on GitHub. Individual and company sponsorships are what keep the project healthy and moving forward.