Dmesg Real Dates/TImestamps
From TheBeard Science Project Wiki
Dmesg shows timestamps in seconds since the last boot, and newer versions of dmesg take the "-T" parameter like dmesg -T
to display dates in human readable format, but in case your server is running an old version here's a great bash function that provides that functionality. I didn't write this I stole it from someone else. Keep in mind that if the system has been put to sleep, suspended, or hibernated then the timestamps will be inaccurate.
dmesg_with_human_timestamps () {
$(type -P dmesg) "$@" | perl -w -e 'use strict;
my ($uptime) = do { local @ARGV="/proc/uptime";<>}; ($uptime) = ($uptime =~ /^(\d+)\./);
foreach my $line (<>) {
printf( ($line=~/^\[\s*(\d+)\.\d+\](.+)/) ? ( "[%s]%s\n", scalar localtime(time - $uptime + $1), $2 ) : $line )
}'
}
alias dmesg=dmesg_with_human_timestamps