In older kernels, the log level and the log flags/facility are not separated. Since the log level is only the last three bits, and the flags/facility and level are separated in the upstream kernel, only print those last three bits when using 'log -m'. Suggested-by: David Jeffery <djeffery@xxxxxxxxxx> Signed-off-by: John Pittman <jpittman@xxxxxxxxxx> --- defs.h | 1 + help.c | 7 ++++--- kernel.c | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/defs.h b/defs.h index 35cdac2..35b983a 100644 --- a/defs.h +++ b/defs.h @@ -5627,6 +5627,7 @@ void clone_bt_info(struct bt_info *, struct bt_info *, struct task_context *); void dump_kernel_table(int); void dump_bt_info(struct bt_info *, char *where); void dump_log(int); +#define LOG_LEVEL(v) ((v) & 0x07) #define SHOW_LOG_LEVEL (0x1) #define SHOW_LOG_DICT (0x2) #define SHOW_LOG_TEXT (0x4) diff --git a/help.c b/help.c index 587c717..62e27d0 100644 --- a/help.c +++ b/help.c @@ -3904,10 +3904,11 @@ char *help_log[] = { " -d Display the dictionary of key/value pair properties that are optionally", " appended to a message by the kernel's dev_printk() function; only", " applicable to the variable-length record format.", -" -m Display the message log level in brackets preceding each message. For", +" -m Display the message log level in brackets preceding each message. For", " the variable-length record format, the level will be displayed in ", -" hexadecimal, and depending upon the kernel version, also contains the", -" facility or flags bits.", +" hexadecimal. In older kernels, by default, the facility/flag bits ", +" will be stripped to only show the level, but if needed, can still be ", +" shown with 'set debug 1'.", " -a Dump the audit logs remaining in kernel audit buffers that have not", " been copied out to the user-space audit daemon.", " ", diff --git a/kernel.c b/kernel.c index ac765e3..735263c 100644 --- a/kernel.c +++ b/kernel.c @@ -5262,6 +5262,8 @@ dump_log_entry(char *logptr, int msg_flags) fprintf(fp, "%s", buf); } + level = LOG_LEVEL(level); + if (msg_flags & SHOW_LOG_LEVEL) { sprintf(buf, "<%x>", level); ilen += strlen(buf); -- 2.17.2 -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/crash-utility