Logs and systemd
Over the last few months, I’ve been slowly fixing bugs in my custom website builder, working towards separating it from this site, and releasing it as open source software.
In the process of cleaning up my tooling, I’ve set up a systemd job to watch my content directory and automatically rebuild the site as I edit it. It usually works seamlessly but, every now and again, it’s useful to be able to see what it’s up to. Since I always forget how to do this, I thought I’d document it here, as much for my own reference as anything else.
Using journalctl
you can view the logs of systemd services. For example, for my site builder service (jbmorley-build.service
), it’s easy to follow the logs with the following command:
journalctl -u jbmorley-build.service -f
The service (or unit), as specified by -u
, is actually a pattern match, so the .service
extension is optional (so long as it’s not ambiguous), meaning it can be be expressed more succinctly as:
journalctl -u jbmorley-build -f
Discovering just how easy systemd is to use and setup (especially coming from macOS and launchd with it’s plist configuration files) has been wonderfully powerful, and something I hope to write about in future posts.