Skip to content

Support bundle collector: one .zip of the whole journal for a chosen start and end time, with a manifest #4127

Closed

Description

@pithead-developer

What's the problem

The host collector bundle_support_collect (lib/pithead/07-support-bundle.sh:237-336) does not deliver what the owner asked for. It is part of tracker #4032.

  • The output is a .tar.gz (07:244, 07:330; 46b-control-support-bundle.sh:23), not a .zip.
  • The window is "N hours back from now", clamped to 1-168 h (07:216, 07:219-235). It has no end time: journalctl gets only --since (07:265).
  • Only 15 hand-kept units are collected (PITHEAD_SUPPORT_UNITS, 07:217). The list misses tari-wallet, wallet-rpc, pithead-lan-guard, pithead-lan-hold, pithead-firstboot, pithead-egress (service and timer), pithead-sync, pithead-journal-persist and more. Nothing else on the system journal is collected: no kernel log, no network, time, podman or systemd lines, no --list-boots.
  • Each unit is silently cut to its newest 2 MiB (tail -c, 07:239, 07:266). A busy monerod or p2pool loses most of a long window and the bundle does not say so.
  • A bundle over 64 MiB is refused outright (07:322-328). The owner gets "could not collect" (46b:17-20) and no way to narrow the window.
  • The bundle does not say how far back the journal reaches. journald is capped at SystemMaxUse=200M (os/rootfs/Dockerfile:176), about 102 h at test load, below the 168 h the UI offers.
  • An empty unit file cannot be told apart from "nothing happened", "journal too short" or "unit missing".

What it impacts

How I found it

This came from a read-only audit of develop at eb929ce on 2026-11-15, against the owner's request and the acceptance criteria of #4032. A second agent verified it. The owner said on 2026-11-15: "make sure 2.0.4 has the export logs feature also. i want to be able to select a time frame and then dump pretty much every log on the system into a zip file for download. this is so we can debug issues users face".

Evidence is the file:line list above. Not verified: whether quadlet containers write their stdout to journald, so whether journalctl -u <unit> already holds container output. The developer must check this first on a provisioned guest and record the answer in the PR.

How important is it

Release blocker for v2.0.4 (owner, 2026-11-12 and 2026-11-15). Every other issue in this set depends on it. Part of #4032.

Acceptance criteria

  • bundle_support_collect writes one .zip (mode 600) named support-bundle-<UTC timestamp>.zip. The control verb stores it as <id>.zip, and the download route (dashboard/mining_dashboard/web/views/download_views.py:52) and the retention code serve it under that name. No .tar.gz is produced by the appliance support-bundle paths. The archive opens with the stock unzip and a desktop zip tool.
  • The collector and the control request take an explicit start and end time (UTC, RFC 3339), passed to journalctl --since and --until. ./pithead recovery-bundle accepts --since and --until. With neither, the window is the last 72 h. The old hours value is still accepted.
  • A start after the end, an unparsable time, or an end in the future is rejected with a clear message and nothing is collected. A start older than the oldest retained entry is clamped to it, and the manifest records the requested and the effective window.
  • The zip holds the whole system journal for the window (all units, redacted) in one file, plus journalctl -k for the window and journalctl --list-boots.
  • A per-unit file exists for every pithead* service and timer and every quadlet-generated unit installed on the box. The list is derived at collect time from the installed unit files and quadlet output, not from a hand-kept string. A guest test installs a new dummy unit and sees it collected without a code change.
  • Silent tail -c truncation is gone. A documented size policy keeps the bundle useful: each file keeps both the oldest and newest lines of its window, within a stated per-file cap and a stated total cap, and a marker line inside the file says what was dropped. The 64 MiB all-or-nothing refusal is replaced by degrading under that policy.
  • manifest.json lists every file with its window, byte size, whether it was truncated (and how many bytes or lines were dropped), and every step that failed or timed out with the reason. It also records the oldest retained journal entry, the journald disk usage and effective settings, the requested and effective window, the pithead version and the collection time.
  • A unit with no lines in the window, a journal shorter than the window and a missing unit are each recorded in the manifest as distinct states.
  • The journald cap in os/rootfs/Dockerfile is raised so retention covers the longest window the UI will offer at measured log volume. If the cap is not raised, the dashboard limits the picker to the retained range (Dashboard: time-frame picker and one-click .zip export, always available, with docs and a browser test #4129) and the manifest says so. The PR states which, and shows the measured figure.
  • Existing redaction (bundle_redact_log and friends) runs on every new file. The seeded-secret tests in tests/stack/control/test-control-support-bundle.sh and tests/integration/selftest/selftest-support-bundle.sh are extended so a seeded secret in the whole-journal, kernel and per-unit files never reaches the zip.
  • The tier-1 shell tests use a journalctl stub that honours --since and --until, so window content is asserted, not only argv. They unzip the result and check the manifest fields above.
  • make check passes.

Possible solutions

  • Build the zip with python3 -I and zipfile, which the collector already uses for the SQLite step (07:294-319). The stock zip binary is not known to be on the appliance. This is not verified.
  • Derive the unit list with systemctl list-unit-files 'pithead*' plus the quadlet output directory used by lib/pithead/36-quadlet-units.sh, or by reading the installed unit directory and generator output.
  • Size policy options: keep a head and a tail slice per file; or drop oldest first with a marker. Pick one and document it in docs/operations.md.
  • Raise SystemMaxUse in proportion to /data free space, if the image can read it at boot, or choose a fixed larger cap. Measure first.

Activity

  1. added this to the v2.0.4 milestone on Nov 15, 2026
  2. added
    enhancement
    appliance
    release-blocker
    P1-user-facing
    on Nov 15, 2026
  3. pithead-developer commented on Nov 16, 2026

    @pithead-developer
    ContributorAuthor

    Merged in #4134.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-user-facingapplianceenhancementrelease-blocker

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions