How can I enable persistent logs on already deployed devices automatically?

Hello, I’m looking for a way to enable persistent logging on my already deployed devices without having to manually connect to every one of them and create the /var/log/journal folder.

From Change in logging behaviour on Ubuntu Core I get that there was supposed to be a configurable option to toggle this behavior but I couldn’t find any documentation on what the name of this option is and judging from what I’ve been finding so far it doesn’t look like it was implemented yet.

To work around this I thought about writing my own configure hook and add it to my gadget snap in order have it create the folder automatically on the next update but now that I’ve done this, I don’t see how I can give permissions to it be able to actually create the folder at that location.

I’ve been going over the interfaces and I don’t see one that I can use to achieve this. Is this even achievable post-deploy without manual intervention? If not, are there any other options that don’t involve doing this in the prepare-device hook (I’m assuming there’s no way I can run it again on existing devices)?

this will be handled via https://github.com/snapcore/snapd/pull/8414

if you can not wait until ths landed you could perhaps try something like:

and simply “remote-log to localhost” as a short term interim solution.

Thank you for your reply. I think I might be able to wait a while for the pull request go through.

Just to confirm that I fully understood this, with this taken care of I should then be able to update my gadget snap to provide a default value for the journal.persistent option which should take effect when the snap is eventually updated. Is that correct?

hmm, i’m not sure how exactly config changes are applied during gadget updates.

I think @mborzecki who implemented gadget updates can tell us more here …