Skip to content

Feature request: journalctl support #1819

Closed

Description

@yaco16

Command

journalctl

Usage stats

37 occurrences in the last 30 days — 3rd most common unhandled command in rtk discover output.

Typical usage patterns

journalctl -b -1 --no-pager -p err -n 50
journalctl -u <service> --since "1 hour ago"
journalctl -f

Expected filtering opportunity

Similar to how rtk ps aux achieves ~92% token reduction by stripping irrelevant process lines, journalctl output contains significant noise:

  • Boot metadata headers
  • Kernel/systemd noise lines unrelated to the queried service
  • Timestamp repetition
  • Priority/facility prefixes that add bulk without value

A rtk journalctl filter could keep only the log message body and strip structural noise, targeting ~60-80% reduction on typical outputs.

Environment

  • systemd-based Linux (Raspberry Pi, aarch64)
  • Common in server/embedded monitoring workflows

Activity

  1. xup6jammy commented on May 11, 2026

    @xup6jammy

    Hi @yaco16 and maintainers — really nice write-up, the rtk discover usage data makes the case very clear.

    I'd like to take a shot at this. Based on CONTRIBUTING.md's TOML-vs-Rust decision criteria, journalctl looks like a good fit for a TOML filter (line-oriented text, regex stripping should hit the 60-80% target, no flag injection or structured parsing needed).

    A couple of design questions before I start, to make sure I align with the project's direction:

    1. Scope of -f (follow mode): Since follow is essentially streaming/interactive, my plan is to not match it in the filter regex and let it pass through unchanged. Does that match your intent?

    2. Rewrite pattern registration: I'd add a RtkRule entry in src/discover/rules.rs so the hook layer auto-rewrites journalctl ... → rtk journalctl ..., similar to how systemctl status is registered. Confirming that's the right approach for a TOML-only filter.

    3. Real samples: If anyone has anonymized journalctl outputs from real workflows (especially the three patterns @yaco16 listed), that would help me calibrate the regex and snapshot tests beyond synthetic fixtures.

    Happy to draft a PR once the direction is confirmed.

  2. added
    enhancement
    help wanted
    on May 27, 2026
  3. pszymkowiak commented on May 27, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    ✨ Category feature
    🟡 Priority medium
    🎯 Confidence 96%

    Summary

    Feature request to add rtk journalctl wrapper for filtering systemd journal output, similar to existing process/command filters; well-scoped with usage data supporting demand.


    Triaged automatically by wshm · This is an automated analysis, not a human review.

  4. yannicklescure commented on Sep 13, 2026

    @yannicklescure

    Another data point from a different workflow, in case it helps size the demand.

    rtk discover on an infrastructure repo — 5 sessions, 1981 Bash commands over 30 days — lists journalctl at 19 invocations among the top unhandled commands.

    Usage here is service diagnosis on a Proxmox host and its guests over SSH, so the shapes are mostly:

    journalctl -b -u <service> -t <ident> --no-pager
    journalctl -u <service> --since "..." -p err
    journalctl -b -1 --no-pager -n 50
    

    Two notes on the design questions:

    • Agreed on leaving -f unmatched. In an agent context follow mode is nearly always a mistake anyway, and passing it through unchanged is the least surprising behavior.
    • rtk log already exists and reads stdin ("Filter and deduplicate log output"), so journalctl ... | rtk log is a usable workaround today. Worth checking whether the journalctl filter can delegate to that dedup logic rather than reimplementing it — journal output from a busy unit is very repetitive, and dedup may be a bigger win than per-line prefix stripping.

    Happy to supply anonymized samples for the patterns above if that helps calibrate the regex.

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

    area:clienhancementhelp wantedplatform:linuxpriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions