Output supervisor logs (journalctl) to a file

Has anyone found a way to write the journalctl logs to a file? The logs on my system only keeps ~8M of data and writing them to a file would be very useful for debugging.

Hi @rossm and welcome to the balena forums!

There is a setting in the OS configuration to persist journal to disk, and that is outlined in the second paragraph here. Furthermore, there is an example showing how to enable that here.

I hope you find this helpful!

Hi @xginn8, thanks for the useful reply! Just a quick question, once the persistent logging in enabled which file is the journalctl logs written to?

Also, is it possible if I can configure if only resin-supervisor logs are written to this file?

The logs can be accessed via the host OS at /var/log/journal. Unfortunately you cannot control which logs are written, and all logs written to journal are stored.

I have opened an issue internally to track your feature request. What kinds of things do you find yourself using the supervisor logs to debug? Do note we recently released improved diagnostics tooling to help with that.

Thanks so much!

Just to confirm, all I would have to configure is the /boot/config.json file to look like

{
 "persistentLogging": false,
 "hostname": "mydevice",
}

@rossm if you want to enable persistent logging, you need to add a "persistentLogging": true line in the config.json file on the boot partition.

Thanks @zvin! Do you know if it’s possible to change where the logs are written to instead of /var/log/journal?