Skip to content

Commit d888ef6

Browse files
daandemeyerpoettering
authored andcommitted
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.
1 parent 7cfe9ec commit d888ef6

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

man/coredumpctl.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@
256256
of access to journal files and possible in-flight coredumps.
257257
</para></listitem>
258258
</varlistentry>
259+
260+
<varlistentry>
261+
<term><option>--all</option></term>
262+
263+
<listitem><para>Look at all available journal files in <filename>/var/log/journal/</filename>
264+
(excluding journal namespaces) instead of only local ones.</para></listitem>
265+
</varlistentry>
259266
</variablelist>
260267
</refsect1>
261268

shell-completion/bash/coredumpctl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ _coredumpctl() {
4040
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
4141
local OPTS='-h --help --version --no-pager --no-legend -o --output -F --field -1
4242
-r --reverse -S --since -U --until -D --directory -q --quiet --debugger
43-
-A --debugger-arguments --json -n'
43+
-A --debugger-arguments --json -n --all'
4444

4545
local -A VERBS=(
4646
[LIST]='list info'

shell-completion/zsh/_coredumpctl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ _arguments \
4343
'--debugger=[Use the given debugger]:debugger: _command_names -e' \
4444
{-D,--directory=}'[Use the journal files in the specified dir]:directory: _directories' \
4545
{-q,--quiet}'[Do not show info messages and privilege warning]' \
46+
'--all[Look at all journal files instead of local ones]' \
4647
'*::coredumpctl commands:_coredumpctl_commands'

src/coredump/coredumpctl.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ static size_t arg_rows_max = SIZE_MAX;
5656
static const char* arg_output = NULL;
5757
static bool arg_reverse = false;
5858
static bool arg_quiet = false;
59+
static bool arg_all = false;
5960

6061
STATIC_DESTRUCTOR_REGISTER(arg_debugger_args, strv_freep);
6162
STATIC_DESTRUCTOR_REGISTER(arg_file, strv_freep);
@@ -125,7 +126,7 @@ static int acquire_journal(sd_journal **ret, char **matches) {
125126
if (r < 0)
126127
return log_error_errno(r, "Failed to open journal files: %m");
127128
} else {
128-
r = sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY);
129+
r = sd_journal_open(&j, arg_all ? 0 : SD_JOURNAL_LOCAL_ONLY);
129130
if (r < 0)
130131
return log_error_errno(r, "Failed to open journal: %m");
131132
}
@@ -184,6 +185,7 @@ static int verb_help(int argc, char **argv, void *userdata) {
184185
" --file=PATH Use journal file\n"
185186
" -D --directory=DIR Use journal files from directory\n\n"
186187
" -q --quiet Do not show info messages and privilege warning\n"
188+
" --all Look at all journal files instead of local ones\n"
187189
"\nSee the %2$s for details.\n",
188190
program_invocation_short_name,
189191
link,
@@ -203,6 +205,7 @@ static int parse_argv(int argc, char *argv[]) {
203205
ARG_JSON,
204206
ARG_DEBUGGER,
205207
ARG_FILE,
208+
ARG_ALL,
206209
};
207210

208211
int c, r;
@@ -223,6 +226,7 @@ static int parse_argv(int argc, char *argv[]) {
223226
{ "until", required_argument, NULL, 'U' },
224227
{ "quiet", no_argument, NULL, 'q' },
225228
{ "json", required_argument, NULL, ARG_JSON },
229+
{ "all", no_argument, NULL, ARG_ALL },
226230
{}
227231
};
228232

@@ -327,6 +331,10 @@ static int parse_argv(int argc, char *argv[]) {
327331

328332
break;
329333

334+
case ARG_ALL:
335+
arg_all = true;
336+
break;
337+
330338
case '?':
331339
return -EINVAL;
332340

0 commit comments

Comments
 (0)