Skip to content

watch

Tail a service journal and explain new errors as they appear in real time.

Usage

bash
hosomaki watch <service> [flags]

Arguments

ArgumentDescription
<service>Systemd service name to tail

Flags

FlagDefaultDescription
--lines <N>10Lines to seed from the journal on startup (0 to skip)
--window <duration>5sSilence window after an error/warning before flushing the batch
--max-lines <N>30Flush the batch when it reaches this many lines regardless of the window

How it works

On startup, watch seeds the view with the last --lines lines from the journal, then enters tail mode.

Incoming lines are accumulated into a batch. The batch is flushed to the pipeline when:

  • A silence window has elapsed and the batch contains at least one error or warning line
  • Or the batch has reached --max-lines

Batches containing only informational lines are discarded silently.

Press Ctrl-C to stop. watch drains any pending batch, cancels the journal tail, and prints a clean shutdown line.

Examples

bash
# Watch nginx
hosomaki watch nginx

# Seed with the last 20 lines
hosomaki watch nginx --lines 20

# Skip seeding entirely
hosomaki watch nginx --lines 0

# Tune batching: shorter window, more lines per batch
hosomaki watch nginx --window 10s --max-lines 50

# Skip seeding, long window for low-volume services
hosomaki watch myapp --lines 0 --window 30s

Low-volume services

For services that log infrequently, increase --window to avoid submitting single-line batches. --window 30s or --window 60s works well for cron-driven services.