From cc4419ed929b5c7c99eaed020b015b1b2e8c7a66 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Sat, 25 Feb 2017 17:29:14 -0500 Subject: coredumpctl,man: mark truncated messages as such in output Unit systemd-coredump@1-3854-0.service is failed/failed, not counting it. TIME PID UID GID SIG COREFILE EXE Fri 2017-02-24 11:11:00 EST 10002 1000 1000 6 none /home/zbyszek/src/systemd-work/.libs/lt-Sat 2017-02-25 00:49:32 EST 26921 0 0 11 error /usr/libexec/fprintd Sat 2017-02-25 11:56:30 EST 30703 1000 1000 - - /usr/bin/python3.5 Sat 2017-02-25 13:16:54 EST 3275 1000 1000 11 present /usr/bin/bash Sat 2017-02-25 17:25:40 EST 4049 1000 1000 11 truncated /usr/bin/bash For info and gdb output, the filename is marked in red and "(truncated)" is appended. (Red is necessary because the annotation is hard to see when running under a pager.) Fixed #3883. --- man/coredumpctl.xml | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) (limited to 'man/coredumpctl.xml') diff --git a/man/coredumpctl.xml b/man/coredumpctl.xml index 5204db4073..2c657fed03 100644 --- a/man/coredumpctl.xml +++ b/man/coredumpctl.xml @@ -154,6 +154,57 @@ matching specified characteristics. If no command is specified, this is the implied default. + The output is designed to be human readable and contains list contains + a table with the following columns: + + + TIME + The timestamp of the crash, as reported by the kernel. + + + + + PID + The identifier of the process that crashed. + + + + + UID + GID + The user and group identifiers of the process that crashed. + + + + + SIGNAL + The signal that caused the process to crash, when applicable. + + + + + COREFILE + Information whether the coredump was stored, and whether + it is still accessible: none means the the core was + not stored, - means that it was not available (for + example because the process was not terminated by a signal), + present means that the core file is accessible by the + current user, journal means that the core was stored + in the journal, truncated is the + same as one of the previous two, but the core was too large and was not + stored in its entirety, error means that the core file + cannot be accessed, most likely because of insufficient permissions, and + missing means that the core was stored in a file, but + this file has since been removed. + + + + EXE + The full path to the executable. For backtraces of scripts + this is the name of the interpreter. + + + It's worth noting that different restrictions apply to data saved in the journal and core dump files saved in /var/lib/systemd/coredump, see overview in @@ -223,9 +274,9 @@ MATCH - General journalctl predicates (see + General journalctl predicate (see journalctl1). - Must contain an equal sign. + Must contain an equals sign (=). -- cgit v1.2.3-54-g00ecf From b9aaa7f4801def92bb4753a780fe1c5302c4de16 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Sun, 26 Feb 2017 18:07:39 -0500 Subject: coredumpctl: print a hint when no journal files are found [guest@fedora ~]$ coredumpctl No coredumps found. [guest@fedora ~]$ ./coredumpctl Hint: You are currently not seeing messages from other users and the system. Users in groups 'adm', 'systemd-journal', 'wheel' can see all messages. Pass -q to turn off this notice. No coredumps found. Fixes #1733. --- man/coredumpctl.xml | 8 ++++++++ src/coredump/coredumpctl.c | 24 ++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) (limited to 'man/coredumpctl.xml') diff --git a/man/coredumpctl.xml b/man/coredumpctl.xml index 2c657fed03..ca8156f77c 100644 --- a/man/coredumpctl.xml +++ b/man/coredumpctl.xml @@ -138,6 +138,14 @@ + + + + + Suppresses info messages about lack + of access to journal files and possible in-flight coredumps. + + diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c index 942c970d8a..93d5e1c9d1 100644 --- a/src/coredump/coredumpctl.c +++ b/src/coredump/coredumpctl.c @@ -36,6 +36,7 @@ #include "fileio.h" #include "fs-util.h" #include "journal-internal.h" +#include "journal-util.h" #include "log.h" #include "macro.h" #include "pager.h" @@ -67,6 +68,7 @@ static int arg_one = false; static FILE* arg_output = NULL; static bool arg_reverse = false; static char** arg_matches = NULL; +static bool arg_quiet = false; static int add_match(sd_journal *j, const char *match) { _cleanup_free_ char *p = NULL; @@ -136,6 +138,7 @@ static void help(void) { " -F --field=FIELD List all values a certain field takes\n" " -o --output=FILE Write output to FILE\n" " -D --directory=DIR Use journal files from directory\n\n" + " -q --quiet Do not show info messages and privilege warning\n" "Commands:\n" " list [MATCHES...] List available coredumps (default)\n" " info [MATCHES...] Show detailed information about one or more coredumps\n" @@ -164,13 +167,14 @@ static int parse_argv(int argc, char *argv[]) { { "reverse", no_argument, NULL, 'r' }, { "since", required_argument, NULL, 'S' }, { "until", required_argument, NULL, 'U' }, + { "quiet", no_argument, NULL, 'q' }, {} }; assert(argc >= 0); assert(argv); - while ((c = getopt_long(argc, argv, "ho:F:1D:S:U:r", options, NULL)) >= 0) + while ((c = getopt_long(argc, argv, "ho:F:1D:rS:U:q", options, NULL)) >= 0) switch(c) { case 'h': arg_action = ACTION_NONE; @@ -233,6 +237,10 @@ static int parse_argv(int argc, char *argv[]) { arg_reverse = true; break; + case 'q': + arg_quiet = true; + break; + case '?': return -EINVAL; @@ -699,7 +707,8 @@ static int dump_list(sd_journal *j) { } if (!arg_field && n_found <= 0) { - log_notice("No coredumps found."); + if (!arg_quiet) + log_notice("No coredumps found."); return -ESRCH; } } @@ -861,8 +870,8 @@ static int dump_core(sd_journal* j) { return r; r = sd_journal_previous(j); - if (r > 0) - log_warning("More than one entry matches, ignoring rest."); + if (r > 0 && !arg_quiet) + log_notice("More than one entry matches, ignoring rest."); return 0; } @@ -956,6 +965,9 @@ static int check_units_active(void) { int c = 0, r; const char *id, *state, *substate; + if (arg_quiet) + return false; + r = sd_bus_default_system(&bus); if (r < 0) return log_error_errno(r, "Failed to acquire bus: %m"); @@ -1036,6 +1048,10 @@ int main(int argc, char *argv[]) { } } + r = journal_access_check_and_warn(j, arg_quiet); + if (r < 0) + goto end; + r = add_matches(j); if (r < 0) goto end; -- cgit v1.2.3-54-g00ecf