Home
  
  

Daily Note for 2020-07-12

July 11, 2020

TIL: Follow journalctl without a huge log-prefix

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 warp it up, I know follow these services with:

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

Russell Matney

Writing, Stories, Software, Indie Games