TIL: Follow journalctl without a huge log-prefix

Created: Jul 13, 2020Published: Mar 28, 2023Last modified: Apr 05, 2023
Word count: 167

My current setup for running yodo locally is via systemctl units. I've enjoyed the always-on nature of working on the app this way, because even if I'm in a completely different context, I can always navigate to the code and tweak some code, and benefit from live-updates via shadow already. For more dedicated repl-driven development, I just cider-connect or cider-connect-cljs to the running apps.

I follow the logs with a command like:

jc --user -fu yodo-fe -u yodo

where jc is my alias for journalctl.

This prints the logs with huge log-line prefixes:

Jul 12 13:03:40 algo start.sh[4673]: <your log here>

When you're using your own logging software, this doubles up on dates, hostnames, etc. Otherwise, it just makes things very wide. UNTIL NOW!

journalctl supports a format via the output -o flag. Reading man journalctl, you'll see the cat option, which prints only the message from your app or service. I assume the naming means journalctl is just calling cat somewhere in there.

To wrap it up, I now follow these services with:

jc --user -fu yodo-fe -u yodo -o cat