On Sat, 2015-05-30 at 11:45 -0400, Dave Anderson wrote:
----- Original Message -----
> It would be useful to have the ability to dump out only certain log
> levels of the kernel log. I know dmesg has '-m' which prepends the log
> level and then you can always use some script logic but would it be easy
> to add another option in crash to do this automatically?
Not particularly easy. In the case of the older pre-variable-length-record format,
the code walks through the log buffer character by character, and prunes any
code between the angle-brackets unless -m is in play. So there's no line-by-line
handling involved for the older kernels. And it would be trival to use -m and simply
grep for the relevant "<#>" at the beginning of each output line.
In the case of variable-length records, it's even uglier because the structure
format
used has changed several times, where it used to have its own structure member, and
then was changed to use multiple different bitmaps-inside-integers. For that reason
alone, I purposely decided to throw in the towel and go with a hexadecimal dump of the
relevant field or all-inclusive member with -m, whichever is applicable. It would be
a PITA to have to handle all the different structural differences.
So in both cases, it's obviously not impossible, but would be kind of ugly.
Dave
> -l level Only display log messages matching 'level', which may be
specified
> as a single number (3) or a range (0-3).
Ok yeah I'm using this right now:
crash> dmesg -m | grep ^\<[01234]\>
Trying to get away from the extra commands where possible but if it's
too much trouble no biggie.
Thanks for looking / explaining.