Skip to content

feat: shipnode logs — follow mode, multi-source, grep #8

Description

@devalade

What to build

Extend shipnode logs from a one-shot PM2 tail into a proper live-debugging tool that covers every log source shipnode already sets up on the server.

New flags:

  • -f, --follow — stream logs continuously until Ctrl-C
  • --source pm2|caddy|system|all — pick the log source (default: pm2, current behavior); all multiplexes them into a single stream with a per-line prefix like [pm2] / [caddy] / [system]
  • --grep <pattern> — server-side filter (piped through grep on the remote so we don't drag the full stream over SSH)
  • --lines n — keeps working, backfills the last n lines before entering follow mode

Sources map to concrete remote commands:

  • pm2pm2 logs <app> --lines n [--raw]
  • caddy → tail Caddy access + error logs (paths taken from the eject template so they stay in sync)
  • systemjournalctl -u <unit> -n n [-f]
  • all → run each subcommand and interleave stdout with a source prefix

Acceptance criteria

  • shipnode logs -f streams new lines until interrupted, then exits cleanly (SSH channel closed, no orphan remote process)
  • shipnode logs --source caddy returns non-empty output on a server that has been serving traffic
  • shipnode logs --source all -f shows interleaved lines with a [source] prefix
  • shipnode logs --grep 500 filters on the remote (verify with set -x that grep runs there, not locally)
  • --lines n still works, and combines with -f (backfill then follow)
  • Ctrl-C leaves no zombie tail/pm2 logs/journalctl -f process on the server

Blocked by

None - can start immediately

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions