0

I am trying to find out how the namespace mechanism of systemd's journald operates.

How to configure it, whether journal namespaces are equal to unix / linux namespaces and how to attach my custom processes to such a namespace to make them able to log to a namespaced journal instead of into the default namespace persistent journal /var/log/journal/12345abcde67890/*.

Are journal namespaces equal to unix / linux namespaces?

I could not quite figure out whether there is a difference between a journal namespace and a linux namespace.

On the linux manpage they more talk about namespace types, while on the systemd manual they talk about namespace names.

Are those equal or are those 2 different worlds?

Depending on the answer of my question above, more detailed questions follow

How to attach a custom process to a journal namespace?

The systemd manual states that a namespace identifier is a short string used for referencing the journal namespace. Will those identifiers need to be one of the 7 (mnt, pid, ipc, net, user, uts, cgroup) linux namespaces?

To offer a new journal namespace systemd-journald listener service, I understood that there must be a copy of the systemd-journald@.service template located in /usr/lib/systemd/system directory. The copy should be given a concrete journal namespace name so that it gets picked up by the systemd-journald service when issuing

    $ systemctl daemon-reload
    $ systemctl restart systemd-journald

Is that right so far?

At this points the magic begins. Now that I am having a new journal namespace service (in a new process), how can I tell my custom process (my hello world program) that it should be attached to the new journal namespace?

When using the journal API sd_journal* I can make dedicated logs into the journal without being a systemd service. Or when being a systemd service, all my stdout / stderr shoud go into the journal. But in either case, it should go into the new namespace journal, located in /var/log/journal/MACHINE_ID.NAMESPACE.

Appreciate any help.

woodz
  • 136
  • 3

0 Answers0