Kernel Log Insights with dmesg
Send custom messages to dmesg output
| Option | Description |
|---|---|
<3> | err |
<4> | warning |
<5> | notice |
<6> | info |
<7> | debug |
echo "<6>Hello from userspace" | sudo tee /dev/kmsg >/dev/null
Dump all data with level warning and errors
dmesg --level=err,warn
Dump all data for all avilable options
dmesg --level=emerg,alert,crit,err,warn,notice,info,debug
Dump all data with level lower then warning
dmesg --level=+warn
Dump kernel log
dmesg
Clear kernel log
dmesg -c
Read kernel log in realtime
dmesg -wxT
With human-readable timestamp
dmesg --time-format --syslog
With human-readable timestamp
dmesg -T
dmesg --time-format iso
dmesg --time-format ctime
dmesg with colored human-readable dates
dmesg -T|sed -e 's|\(^.*'`date +%Y`']\)\(.*\)|\x1b[0;34m\1\x1b[0m - \2|g'
Get cpu info from dmesg
dmesg | grep cpu