v2.15.0: Log archiving and cron/log reliability fixes
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), plusPITCHFORK_DAEMON_IDandPITCHFORK_ARCHIVE_REASON(ageorcount) 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 inpitchfork.tomlwithcron = "..."but noboot_startnever 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 statusfalls back to config and reports them asavailableinstead of "not found",proxy listmatches, andpitchfork cleanpreserves entries that have acron_schedule. The/statsweb API also gains anavailablecount. -
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_logsmixed timestamp-based initial fetch with id-based polling, and the timestamp was captured before IPC started, solast_idstayed at 0 and the nexttail(0)returned the entire log history. Both paths now anchor on the daemon's current max row id. -
Dependency updates:
tower-http0.7 (#558),cron0.17 (#556),itertools0.15 (#557).
Documentation
$PORTNenv 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.