Skip to contentSkip to conversation

dmesg(1) changes

DISCUSSION Karel Zak 4 participants 6 messages Jul 14, 2011 – Jul 18, 2011 Util-Linux package

lore
Share & tools
lore

Karel Zak

author maintainer
#0 lore raw

Hi,

I did some changes to dmesg(1) in last days:

* \x<hex> encoding is used for non-printable chars and invalid multibyte sequences

* add --decode option to decode facility and level (priotity) number to human readable prefixes, for example:

    $ dmesg --decode
    kern  :info  : [53335.593617] ata1.00: configured for UDMA/100
    kern  :info  : [53335.743185] PM: resume of devices complete after 2496.795 msecs
    kern  :debug : [53335.743593] PM: Finishing wakeup.
    kern  :warn  : [53335.743595] Restarting tasks ... done.
    kern  :info  : [53335.790452] video LNXVIDEO:00: Restoring backlight state

* add --facility=<LIST> option to filter out messages, for example:

    $ dmesg --facility=daemon,user
    [    1.802065] dracut: dracut-009-11.fc15
    [    1.811267] dracut: rd.luks=0: removing cryptoluks activation
    [    1.813913] dracut: rd.lvm=0: removing LVM activation
    [    1.819348] udev[111]: starting version 167

* add --level=<LIST> option to filter out messages, for example:

    $ dmesg --level=debug,info
    $ dmesg --facility=kern --level=warn,err

* add --clear option to clear the kernel ring buffer

* add --read-clear to read and clear the kernel ring buffer

* add --console-off and --console-on to control output to console

* -n <LEVEL> (--console-level) supports human readable level names, for example:

    $ dmesg --console-level=emerg,alert

Comments & suggestions?

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#1 lore raw
Quoted 10 lines · Karel Zak

* add --facility=<LIST> option to filter out messages, for example:

    $ dmesg --facility=daemon,user
    [    1.802065] dracut: dracut-009-11.fc15
    [    1.811267] dracut: rd.luks=0: removing cryptoluks activation
    [    1.813913] dracut: rd.lvm=0: removing LVM activation
    [    1.819348] udev[111]: starting version 167

Comments & suggestions?

This is really cool! Thanks a lot for implementing this!

One last thing on my wishlist: "dmesg -k" as alias for "dmesg --facility=kern", just to make this presumably very often requested switch is easy to reach.

Lennart

Signature · 1 line
Lennart Poettering - Red Hat, Inc.
author maintainer
#2 lore raw
Quoted 3 lines · Lennart Poettering

One last thing on my wishlist: "dmesg -k" as alias for "dmesg --facility=kern", just to make this presumably very often requested switch is easy to reach.

Added:

-u : userspace messages
-k : kernel messages

Quoted 3 lines · Kay Sievers

People ask since a while for an option to suppress the kernel's [...] timestamp from the 'dmesg' output. Maybe you can make them happy too. :)

Added -t to suppress the timestamps.

 $ dmesg -u -t
 dracut: dracut-009-11.fc15
 dracut: rd.luks=0: removing cryptoluks activation
 dracut: rd.lvm=0: removing LVM activation
 udev[111]: starting version 167
 dracut: Starting plymouth daemon
 dracut: rd.dm=0: removing DM RAID activation
 dracut: rd.md=0: removing MD RAID activation
 dracut: Checking filesystems
 dracut: fsck -T -t noopts=_netdev -A -a
 dracut: /dev/sda3: clean, 194520/1921360 files, 1601560/7680000
 blocks
 dracut: Remounting
 /dev/disk/by-uuid/2cda1e08-1f22-490b-9101-c93d511bc9d9 with -o ro,
 dracut: Mounted root filesystem /dev/sda3
 dracut: Switching root
 udev[451]: starting version 167

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#3 lore raw
In reply to Karel Zak
Quoted 6 lines · Karel Zak

I did some changes to dmesg(1) in last days:

=C2=A0* \x<hex> encoding is used for non-printable chars and invalid =C2=A0 multibyte sequences

=C2=A0* add --decode option to decode facility and level (priotity) numbe=

r to

Quoted 4 lines

=C2=A0 human readable prefixes, for example:

=C2=A0 =C2=A0$ dmesg --decode
=C2=A0 =C2=A0kern =C2=A0:info =C2=A0: [53335.593617] ata1.00: configured =

for UDMA/100

Quoted 1 line

=C2=A0 =C2=A0kern =C2=A0:info =C2=A0: [53335.743185] PM: resume of device=

s complete after 2496.795 msecs

Quoted 2 lines

=C2=A0 =C2=A0kern =C2=A0:debug : [53335.743593] PM: Finishing wakeup. =C2=A0 =C2=A0kern =C2=A0:warn =C2=A0: [53335.743595] Restarting tasks ...=

done.

Quoted 1 line

=C2=A0 =C2=A0kern =C2=A0:info =C2=A0: [53335.790452] video LNXVIDEO:00: R=

estoring backlight state

Quoted 2 lines

=C2=A0* add --facility=3D<LIST> option to filter out messages, for exampl=

e:

Quoted 4 lines

=C2=A0 =C2=A0$ dmesg --facility=3Ddaemon,user
=C2=A0 =C2=A0[ =C2=A0 =C2=A01.802065] dracut: dracut-009-11.fc15 =C2=A0 =C2=A0[ =C2=A0 =C2=A01.811267] dracut: rd.luks=3D0: removing crypt=

oluks activation

Quoted 1 line

=C2=A0 =C2=A0[ =C2=A0 =C2=A01.813913] dracut: rd.lvm=3D0: removing LVM ac=

tivation

Quoted 12 lines

=C2=A0 =C2=A0[ =C2=A0 =C2=A01.819348] udev[111]: starting version 167

=C2=A0* add --level=3D<LIST> option to filter out messages, for example:

=C2=A0 =C2=A0$ dmesg --level=3Ddebug,info

=C2=A0 =C2=A0$ dmesg --facility=3Dkern --level=3Dwarn,err

=C2=A0* add --clear option to clear the kernel ring buffer

=C2=A0* add --read-clear to read and clear the kernel ring buffer

Quoted 8 lines

=C2=A0* add --console-off and --console-on to control output to console

=C2=A0* -n <LEVEL> (--console-level) supports human readable level names, =C2=A0 for example:

=C2=A0 =C2=A0$ dmesg --console-level=3Demerg,alert

Comments & suggestions?

Sounds all great. Thanks for adding this before people start complaining that we fill the kernel log with 'userspace crap'. I actually removed all syslog daemons from my systems, and use only 'dmesg' these days, and no log is stored on disk, I just don't need it.

People ask since a while for an option to suppress the kernel's [...] timestamp from the 'dmesg' output. Maybe you can make them happy too. :)

Thanks,
Kay

#4 lore raw
In reply to Karel Zak

Am 14.07.2011 13:52, schrieb Karel Zak:

Quoted 4 lines

Hi,

I did some changes to dmesg(1) in last days:

Thanks for these advances.

While we're making a wishlist, I always wanted a 'follow' option (similar to tail -f/-F) for dmesg.

author maintainer
#5 lore raw
Quoted 10 lines · Thomas Bächler

Am 14.07.2011 13:52, schrieb Karel Zak:

Quoted 4 lines

Hi,

I did some changes to dmesg(1) in last days:

Thanks for these advances.

While we're making a wishlist, I always wanted a 'follow' option (similar to tail -f/-F) for dmesg.

It's not so simple:
http://www.spinics.net/lists/util-linux-ng/msg04453.html

I'll try to play with that a little more later. Now I'd like to release 2.20 ASAP.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com