How to make human readable timestamps

dnsg

Command dmesg (short for display message) is an UNIX command used in order to print to stdout the “kernel buffer” messages. This cmd is useful  for booting  messages (when HW is initialized)…

http://linux.die.net/man/1/dmesg

Time stamps

If you haven’t “-T” option (dmesg -T shows readable timestamps) for human readable timestamps you can use following 1-line :

dmesg | awk -F ] '{"cat /proc/uptime | cut -d \" \" -f 1" | getline st;a=substr( $1,2, length($1) - 1);print strftime("%F %H:%M:%S %Z",systime()-st+a)" -> "$0}' | more

or (multiline)

dmesg\
| awk -F ] '{"cat /proc/uptime | cut -d \" \" -f 1"\
| getline st;a=substr( $1,2, length($1) - 1);\
print strftime("%F %H:%M:%S %Z",systime()-st+a)" -> "$0}' | more

Output:

...
 2013-08-15 16:43:34 CEST -> [762273.568828] eth0: link down
 2013-08-15 16:47:08 CEST -> [762487.411978] eth0: link up, full duplex, speed 1 Gbps
...