Unix administration stuff that was hard to find out using Google and caused a lot of try and error. Hereby given back to the net...
|
|
Tweet |
|
Link Collections Linux Security Tools Projects Recent Posts
Comments
|
Filtering dmesg Output
Submitted by Lars Windolf on 10. October 2012 - 20:43.
Many administrators just run "dmesg" to check a system for problems and do not bother with its options. But actually it is worth to know about the filtering and output options of the most recent versions (Note: older distros e.g. CentOS5 might not yet ship these options!). You always might want to use "-T" to show human readable timestamps: $ dmesg -T [...] [Wed Oct 10 20:31:22 2012] Buffer I/O error on device sr0, logical block 0 [Wed Oct 10 20:31:22 2012] sr 1:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [...] Additionally the severity and source of the messages is interesting (option -x): $ dmesg -xT [...] kern :err : [Wed Oct 10 20:31:21 2012] Buffer I/O error on device sr0, logical block 0 kern :info : [Wed Oct 10 20:31:21 2012] sr 1:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE [...] Now we see that only one of those example message lines was an actual error. But we can even filter for errors or worse ignoring all the boot messages (option -l): $ dmesg -T -l err,crit,alert,emerg [...] [Wed Oct 10 20:31:21 2012] Buffer I/O error on device sr0, logical block 0 [...] In the same way it is possible to filter the facility (the first column in the -x output). For example this could return: $ dmesg -T -f daemon [...] [Wed Oct 10 19:57:50 2012] udevd[106]: starting version 175 [Wed Oct 10 19:58:08 2012] udevd[383]: starting version 175 [...] In any case it might be worth remembering:
|
Post new comment