journalscope

Small binary to make journalctl output more useful.

the problem

11 services, one firehose. Which one is on fire?

deploy@prod-1:~ — journalctl -f
Nov 22 14:03:07 prod-1 metrics-exporter[1187]: gc pause 4.4ms
Nov 22 14:03:07 prod-1 metrics-exporter[1187]: push ok (204) after 19ms
Nov 22 14:03:07 prod-1 postgres[771]: LOG:  checkpoint starting: time
Nov 22 14:03:07 prod-1 indexer[3310]: Polling job queue
Nov 22 14:03:07 prod-1 sshd[48211]: Invalid user ubnt from 203.0.113.159 port 62243
Nov 22 14:03:07 prod-1 systemd[1]: Started session-556.scope - Session of User deploy.
Nov 22 14:03:08 prod-1 CRON[51022]: (root) CMD (/usr/local/bin/backup.sh --really-this-time)
Nov 22 14:03:08 prod-1 metrics-exporter[1187]: cardinality is fine. cardinality is fine. cardinality is fine.
Nov 22 14:03:09 prod-1 nginx[902]: upstream timed out (110: Connection timed out) while reading response header from upstream
Nov 22 14:03:09 prod-1 kernel: hrtimer: interrupt took 38993 ns
Nov 22 14:03:10 prod-1 systemd[1]: logrotate.service: Deactivated successfully.
Nov 22 14:03:10 prod-1 systemd[1]: checkout-api.service: Scheduled restart job, restart counter is at 12.
Nov 22 14:03:10 prod-1 metrics-exporter[1187]: cardinality is fine. cardinality is fine. cardinality is fine.
Nov 22 14:03:11 prod-1 dockerd[1044]: level=info msg="ignoring event" module=libcontainerd topic=/tasks/delete
Nov 22 14:03:11 prod-1 nginx[902]: 192.0.2.253 "GET /wp-login.php HTTP/1.1" 404 (this is not WordPress)
Nov 22 14:03:12 prod-1 systemd[1]: Starting logrotate.service - Rotate log files...
Nov 22 14:03:13 prod-1 checkout-api[2211]: request 7795 timed out after 5000ms
Nov 22 14:03:13 prod-1 metrics-exporter[1187]: scraped 1501 series in 19ms
Nov 22 14:03:13 prod-1 postgres[771]: LOG:  checkpoint starting: time
Nov 22 14:03:13 prod-1 checkout-api[2211]: request 7360 timed out after 5000ms
Nov 22 14:03:14 prod-1 nginx[902]: 192.0.2.135 "GET /.env HTTP/1.1" 404
Nov 22 14:03:15 prod-1 nginx[902]: upstream timed out (110: Connection timed out) while reading response header from upstream
Nov 22 14:03:15 prod-1 sshd[48211]: Connection closed by authenticating user root 203.0.113.146 port 64512 [preauth]
Nov 22 14:03:16 prod-1 sshd[48211]: banner exchange: Connection from 192.0.2.24: invalid format
Nov 22 14:03:17 prod-1 indexer[3310]: Polling job queue (1 pending)
Nov 22 14:03:18 prod-1 nginx[902]: 198.51.100.100 "GET /healthz HTTP/1.1" 200
Nov 22 14:03:18 prod-1 systemd[1]: Started session-657.scope - Session of User deploy.
Nov 22 14:03:19 prod-1 metrics-exporter[1187]: scraped 2067 series in 20ms

the solution

Loudest service first. Click the spike, land on the first error.

jscope
JournalScope at 146 entries a minute. The services column ranks metrics first and flags checkout-api as rising, while the journal shows its connection-pool warnings turning into request timeouts.

try it

watch a fake fire (demo replay)

  • 16384.dev
    nix run git+https://git.16384.dev/journalscope.git#demo
  • github
    nix run github:adamloghry/jscope#demo

watch your own fire

  • 16384.dev
    nix run git+https://git.16384.dev/journalscope.git
  • github
    nix run github:adamloghry/jscope

no nix? cargo

  • 16384.dev
    cargo install --locked --git https://git.16384.dev/journalscope.git
  • github
    cargo install --locked --git https://github.com/adamloghry/jscope