Also I was wondering where in the code does journald.config file changes are parsed?
For example in the above code , the line :-
if (s->storage == STORAGE_PERSISTENT)
Here, s->storage corresponds to 'Storage' option of conf file right?
How is it getting set when we edit the conf file?
Also, on doing "ls /run/log/journal/machine_id/"
I can see output as following
<some_big_number>.journal
<some_another_big_number>.journal
.
.
.
system.journal
Is 'system.journal' is the currently active journal and rest are archived journals?
Nishant
On Sun, 29 Aug 2021 at 17:56, Michael Chapman <mike@xxxxxxxxxxxxxxxxx> wrote:
On Sun, 29 Aug 2021, Nishant Nayan wrote:
> I was looking into the code of systemd-journald and found this (in
> system_journal_open() ) :-
>
> if (!s->system_journal && IN_SET(s->storage, STORAGE_PERSISTENT,
> STORAGE_AUTO) && (flush_requested || flushed_flag_is_set())) {
>
> /* If in auto mode: first try to create the machine
> * path, but not the prefix.
> *
> * If in persistent mode: create /var/log/journal and
> * the machine path */
>
> if (s->storage == STORAGE_PERSISTENT)
> (void) mkdir_p("/var/log/journal/", 0755);
>
> (void) mkdir(s->system_storage.path, 0755);
>
> fn = strjoina(s->system_storage.path, "/system.journal");
[...]
>
> Also after reading the comment, how is it possible to create
> '/var/log/journal/machine_id' without creating the prefix? I am assuming
> '/var/log/journal' is the prefix .
Sorry, I actually misread your question here.
In Storage=auto mode, no attempt to create the /var/log/journal directory
is made. If it doesn't exist, then the persistent journal simply fails to
be opened.