From: Daan De Meyer Date: Wed, 6 Oct 2021 12:47:46 +0000 (+0100) Subject: coredump: Add --all option X-Git-Tag: v250-rc1~549 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d888ef68d11de94c975d3418d600a11e516efdc6;p=thirdparty%2Fsystemd.git coredump: Add --all option This option has coredumpctl look at all journals instead of only the local ones. This allows coredumpctl to show information about remote coredumps if the coredumps are made available in /var/lib/systemd/coredump and the corresponding journals are made available in /var/log/journal. This is already possible using the --directory option but --all makes it more user friendly since users don't have to enter the journal directory anymore as long as it's available under /var/log/journal. --- diff --git a/man/coredumpctl.xml b/man/coredumpctl.xml index d45ed753b25..2a1f6541125 100644 --- a/man/coredumpctl.xml +++ b/man/coredumpctl.xml @@ -256,6 +256,13 @@ of access to journal files and possible in-flight coredumps. + + + + + Look at all available journal files in /var/log/journal/ + (excluding journal namespaces) instead of only local ones. + diff --git a/shell-completion/bash/coredumpctl b/shell-completion/bash/coredumpctl index 54b85725158..b43338eb21d 100644 --- a/shell-completion/bash/coredumpctl +++ b/shell-completion/bash/coredumpctl @@ -40,7 +40,7 @@ _coredumpctl() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --no-pager --no-legend -o --output -F --field -1 -r --reverse -S --since -U --until -D --directory -q --quiet --debugger - -A --debugger-arguments --json -n' + -A --debugger-arguments --json -n --all' local -A VERBS=( [LIST]='list info' diff --git a/shell-completion/zsh/_coredumpctl b/shell-completion/zsh/_coredumpctl index ae62e50f3a4..dad21a74ad8 100644 --- a/shell-completion/zsh/_coredumpctl +++ b/shell-completion/zsh/_coredumpctl @@ -43,4 +43,5 @@ _arguments \ '--debugger=[Use the given debugger]:debugger: _command_names -e' \ {-D,--directory=}'[Use the journal files in the specified dir]:directory: _directories' \ {-q,--quiet}'[Do not show info messages and privilege warning]' \ + '--all[Look at all journal files instead of local ones]' \ '*::coredumpctl commands:_coredumpctl_commands' diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c index b7957921ef0..2eaa56a4fd9 100644 --- a/src/coredump/coredumpctl.c +++ b/src/coredump/coredumpctl.c @@ -56,6 +56,7 @@ static size_t arg_rows_max = SIZE_MAX; static const char* arg_output = NULL; static bool arg_reverse = false; static bool arg_quiet = false; +static bool arg_all = false; STATIC_DESTRUCTOR_REGISTER(arg_debugger_args, strv_freep); STATIC_DESTRUCTOR_REGISTER(arg_file, strv_freep); @@ -125,7 +126,7 @@ static int acquire_journal(sd_journal **ret, char **matches) { if (r < 0) return log_error_errno(r, "Failed to open journal files: %m"); } else { - r = sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY); + r = sd_journal_open(&j, arg_all ? 0 : SD_JOURNAL_LOCAL_ONLY); if (r < 0) return log_error_errno(r, "Failed to open journal: %m"); } @@ -184,6 +185,7 @@ static int verb_help(int argc, char **argv, void *userdata) { " --file=PATH Use journal file\n" " -D --directory=DIR Use journal files from directory\n\n" " -q --quiet Do not show info messages and privilege warning\n" + " --all Look at all journal files instead of local ones\n" "\nSee the %2$s for details.\n", program_invocation_short_name, link, @@ -203,6 +205,7 @@ static int parse_argv(int argc, char *argv[]) { ARG_JSON, ARG_DEBUGGER, ARG_FILE, + ARG_ALL, }; int c, r; @@ -223,6 +226,7 @@ static int parse_argv(int argc, char *argv[]) { { "until", required_argument, NULL, 'U' }, { "quiet", no_argument, NULL, 'q' }, { "json", required_argument, NULL, ARG_JSON }, + { "all", no_argument, NULL, ARG_ALL }, {} }; @@ -327,6 +331,10 @@ static int parse_argv(int argc, char *argv[]) { break; + case ARG_ALL: + arg_all = true; + break; + case '?': return -EINVAL;