From cb30d3ba665d9185d0691b265437e347d0d004fd Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 30 Aug 2017 16:56:41 +0900 Subject: [PATCH 1/2] journal-remote: show error if SplitMode=host with 'active' source is specified --- src/journal-remote/journal-remote.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 7201421d91..64b1105901 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -66,7 +66,7 @@ static int arg_seal = false; static int http_socket = -1, https_socket = -1; static char** arg_gnutls_log = NULL; -static JournalWriteSplitMode arg_split_mode = JOURNAL_WRITE_SPLIT_HOST; +static JournalWriteSplitMode arg_split_mode = _JOURNAL_WRITE_SPLIT_INVALID; static char* arg_output = NULL; static char *arg_key = NULL; @@ -1492,9 +1492,17 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; } + if (!IN_SET(arg_split_mode, JOURNAL_WRITE_SPLIT_NONE, _JOURNAL_WRITE_SPLIT_INVALID)) { + log_error("For active sources, only --split-mode=none is allowed."); + return -EINVAL; + } + arg_split_mode = JOURNAL_WRITE_SPLIT_NONE; } + if (arg_split_mode == _JOURNAL_WRITE_SPLIT_INVALID) + arg_split_mode = JOURNAL_WRITE_SPLIT_HOST; + if (arg_split_mode == JOURNAL_WRITE_SPLIT_NONE && arg_output) { if (is_dir(arg_output, true) > 0) { log_error("For SplitMode=none, output must be a file."); From e64aae43dd3480b1cc03d4a29f1f81ca814da984 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 30 Aug 2017 17:03:37 +0900 Subject: [PATCH 2/2] man: journal-remote: add detailed condition when SplitMode=none must be used --- man/systemd-journal-remote.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/man/systemd-journal-remote.xml b/man/systemd-journal-remote.xml index d37b9b2021..1f1c305267 100644 --- a/man/systemd-journal-remote.xml +++ b/man/systemd-journal-remote.xml @@ -203,8 +203,7 @@ Sinks The location of the output journal can be specified - with or . For "active" - sources, this option is required. + with or . @@ -261,7 +260,8 @@ is used, based on the hostname of the other endpoint of a connection. - In case of "active" sources, the output file name must + In the case that "active" sources are given by the positional + arguments or option, the output file name must always be given explicitly and only none is allowed.