diff --git a/man/coredumpctl.xml b/man/coredumpctl.xml index d45ed753b2..2a1f654112 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 54b8572515..b43338eb21 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 ae62e50f3a..dad21a74ad 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 b7957921ef..2eaa56a4fd 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;