mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
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.
This commit is contained in:
committed by
Lennart Poettering
parent
7cfe9ec983
commit
d888ef68d1
@@ -256,6 +256,13 @@
|
||||
of access to journal files and possible in-flight coredumps.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--all</option></term>
|
||||
|
||||
<listitem><para>Look at all available journal files in <filename>/var/log/journal/</filename>
|
||||
(excluding journal namespaces) instead of only local ones.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user