1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-06 12:58:22 +03:00

journal: make namespace invocation also support drop-in config

This commit is contained in:
Yu Watanabe 2021-03-04 16:38:18 +09:00
parent e6283cbf48
commit 005c7b1d88
2 changed files with 15 additions and 9 deletions

View File

@ -28,6 +28,9 @@
<para><filename>/run/systemd/journald.conf.d/*.conf</filename></para>
<para><filename>/usr/lib/systemd/journald.conf.d/*.conf</filename></para>
<para><filename>/etc/systemd/journald@<replaceable>NAMESPACE</replaceable>.conf</filename></para>
<para><filename>/etc/systemd/journald@<replaceable>NAMESPACE</replaceable>.conf.d/*.conf</filename></para>
<para><filename>/run/systemd/journald@<replaceable>NAMESPACE</replaceable>.conf.d/*.conf</filename></para>
<para><filename>/usr/lib/systemd/journald@<replaceable>NAMESPACE</replaceable>.conf.d/*.conf</filename></para>
</refsynopsisdiv>
<refsect1>
@ -41,8 +44,9 @@
<para>The <command>systemd-journald</command> instance managing the default namespace is configured by
<filename>/etc/systemd/journald.conf</filename> and associated drop-ins. Instances managing other
namespaces read <filename>/etc/systemd/journald@<replaceable>NAMESPACE</replaceable>.conf</filename> with
the namespace identifier filled in. This allows each namespace to carry a distinct configuration. See
namespaces read <filename>/etc/systemd/journald@<replaceable>NAMESPACE</replaceable>.conf</filename>
and associated drop-ins with the namespace identifier filled in. This allows each namespace to carry
a distinct configuration. See
<citerefentry><refentrytitle>systemd-journald.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
for details about journal namespaces.</para>
</refsect1>

View File

@ -1625,17 +1625,19 @@ static int server_parse_config_file(Server *s) {
assert(s);
if (s->namespace) {
const char *namespaced;
const char *namespaced, *dropin_dirname;
/* If we are running in namespace mode, load the namespace specific configuration file, and nothing else */
namespaced = strjoina(PKGSYSCONFDIR "/journald@", s->namespace, ".conf");
dropin_dirname = strjoina("journald@", s->namespace, ".conf.d");
r = config_parse(NULL,
namespaced, NULL,
"Journal\0",
config_item_perf_lookup, journald_gperf_lookup,
CONFIG_PARSE_WARN, s,
NULL);
r = config_parse_many(
STRV_MAKE_CONST(namespaced),
(const char* const*) CONF_PATHS_STRV("systemd"),
dropin_dirname,
"Journal\0",
config_item_perf_lookup, journald_gperf_lookup,
CONFIG_PARSE_WARN, s, NULL);
if (r < 0)
return r;