Mittwoch Mai 23, 2012

Kernel dmesg Timestamp umwandeln

Wenn man so einen dmesg Output hier 

[120150.785488] nfs: server 10.232.218.3 not responding, timed out
[120450.903514] nfs: server 10.232.218.3 not responding, timed out
[120452.071783] nfs: server 10.232.218.3 not responding, timed out
[120462.577351] nfs: server 10.232.218.3 not responding, timed out

in ein lesbares Datumsformat umwandeln will

Wed May 23 07:52:55 2012 nfs: server 10.232.218.3 not responding, timed out
Wed May 23 07:57:55 2012 nfs: server 10.232.218.3 not responding, timed out
Wed May 23 07:57:57 2012 nfs: server 10.232.218.3 not responding, timed out
Wed May 23 07:58:07 2012 nfs: server 10.232.218.3 not responding, timed out

nimmt man das hier: 

alias tmesg='dmesg|perl -ne "BEGIN{\$a= time()- qx!cat /proc/uptime!};s/\[\s*(\d+)\.\d+\]/localtime(\$1 + \$a)/e; print \$_;"'

Kommentare:

Senden Sie einen Kommentar:
  • HTML Syntax: Ausgeschaltet