The _INITRD field is a boolean field (0 or 1) that specifies whether
a message was processed by systemd-journald in the initrd or not.
for details about journal namespaces.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>_SYSTEM_CONTEXT=</varname></term>
+
+ <listitem><para>A string field that specifies the context in which the message was logged. If
+ <literal>initrd</literal>, the log message was processed while systemd-journald
+ was running inside the initrd. If <literal>main</literal>, the log message was generated after
+ journald switched root to the root filesystem.</para></listitem>
+ </varlistentry>
</variablelist>
</refsect1>
if (!isempty(s->namespace_field))
iovec[n++] = IOVEC_MAKE_STRING(s->namespace_field);
+ if (in_initrd())
+ iovec[n++] = IOVEC_MAKE_STRING("_SYSTEM_CONTEXT=initrd");
+ else
+ iovec[n++] = IOVEC_MAKE_STRING("_SYSTEM_CONTEXT=main");
+
assert(n <= m);
if (s->split_mode == SPLIT_UID && c && uid_is_valid(c->uid))
#define SERVER_MACHINE_ID(s) ((s)->machine_id_field + STRLEN("_MACHINE_ID="))
/* Extra fields for any log messages */
-#define N_IOVEC_META_FIELDS 23
+#define N_IOVEC_META_FIELDS 24
/* Extra fields for log messages that contain OBJECT_PID= (i.e. log about another process) */
#define N_IOVEC_OBJECT_FIELDS 18