brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: journalctl --truncate-newline shows only the first line of multiline messages

Journalctl
~/tips/tip-journalctl-truncate-newline-first-line

journalctl --truncate-newline -u myapp

Cuts every message after its first line, so long traces do not flood the screen.

Stack traces and long dumps make a log scroll for pages, and I usually want the headline of each entry.

--truncate-newline cuts each message at its first newline. A multiline error becomes one line, so the list of entries stays readable. When one of them looks interesting, run the command again without the flag for that time range.

journalctl --truncate-newline -u myapp

The flag arrived in systemd 254, so older distributions do not have it. Check journalctl --version first.

Further reading: journalctl(1) manual page

More Journalctl tips journalctl -k -g 'killed process' --since "2 days ago" journalctl _PID=1 -b ls -lh /var/log/journal/*/*.journal~ Storage=volatile sudo journalctl --setup-keys All Journalctl tips (81) All topics

Link