How to create a journald namespace?

I want to create a namespaced journal file, something like a journald@volatile.conf, with the contents

[Journal]
storage=volatile

currently I’m thinking of just doing

environment.etc."systemd/journald@volatile.conf" = {
  text = ''
   <text from above here>
  ''
}

Is there any other way to do this?

1 Like

Try this one first: services.journald.storage

Sorry I should have clarified. Basically I want the default namespace journal.conf to remain the same, but I want a new additional namespace to be volatile, so I can move extra chatty services that I dont care about to the new volatile namespace.

So basically:
journal.conf remains the same
journal@volatile.conf creates a new namespace that has volatile storage that I can use to override for existing services

Right now the environment.etc thing works. But I was wondering if there was a cleaner way than manually setting the file + text

What you have looks reasonable. The services.journald module is implemented the same way and I don’t see anything in nixpkgs that does this already.