diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-04-30 12:26:27 +0200 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-04-30 14:19:55 +0200 |
commit | 123450e58eeb5dfc539cd0f71c85d2b9e0ed0851 (patch) | |
tree | d9f3cdceece1b32fd8fa509a2a3e864c83e86d06 /src/journal | |
parent | build(deps): bump pkg/debian from `640ff73` to `9a5adf2` (diff) | |
download | systemd-123450e58eeb5dfc539cd0f71c85d2b9e0ed0851.tar.xz systemd-123450e58eeb5dfc539cd0f71c85d2b9e0ed0851.zip |
journal: Add journal.storage credential
In mkosi CI, we want persistent journals when running interactively
and runtime journals when running in CI, so let's add a credential
that allows us to configure which one to use.
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journald-server.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index c78678f1f6..dfad063e47 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -2522,17 +2522,27 @@ static void server_load_credentials(Server *s) { assert(s); - /* if we already have a forward address from config don't load the credential */ - if (s->forward_to_socket.sockaddr.sa.sa_family != AF_UNSPEC) - return log_debug("Socket forward address already set not loading journal.forward_to_socket"); - r = read_credential("journal.forward_to_socket", &data, NULL); if (r < 0) - return (void) log_debug_errno(r, "Failed to read credential journal.forward_to_socket, ignoring: %m"); + log_debug_errno(r, "Failed to read credential journal.forward_to_socket, ignoring: %m"); + else { + r = socket_address_parse(&s->forward_to_socket, data); + if (r < 0) + log_debug_errno(r, "Failed to parse socket address '%s' from credential journal.forward_to_socket, ignoring: %m", (char *) data); + } + + data = mfree(data); - r = socket_address_parse(&s->forward_to_socket, data); + r = read_credential("journal.storage", &data, NULL); if (r < 0) - log_debug_errno(r, "Failed to parse credential journal.forward_to_socket, ignoring: %m"); + log_debug_errno(r, "Failed to read credential journal.storage, ignoring: %m"); + else { + r = storage_from_string(data); + if (r < 0) + log_debug_errno(r, "Failed to parse storage '%s' from credential journal.storage, ignoring: %m", (char *) data); + else + s->storage = r; + } } int server_new(Server **ret) { @@ -2617,9 +2627,8 @@ int server_init(Server *s, const char *namespace) { journal_reset_metrics(&s->system_storage.metrics); journal_reset_metrics(&s->runtime_storage.metrics); - server_parse_config_file(s); - server_load_credentials(s); + server_parse_config_file(s); if (!s->namespace) { /* Parse kernel command line, but only if we are not a namespace instance */ |