2019年11月27日水曜日

シェル芸で dmesg に分かり易いタイムスタンプを付加してみたが・・・

ふと思い付きで、dmesg の左端のタイムスタンプを分かり易くできるのでは、と閃いた。。。
[root@hoge ~]# (date -d"$(uptime -s)" +%s;dmesg)|awk -F\[ 'BEGIN {getline b} {print strftime("%F %T",b+$2),$0}'
...
2019-11-27 21:46:52 [52976.500320] IPv6: ADDRCONF(NETDEV_UP): wlp4s0: link is not ready
2019-11-27 21:47:10 [52994.337872] [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe B (start=92367 end=92368) time 177 us, min 1073, max 1079, scanline start 1069, end 1077
2019-11-27 21:47:11 [52995.637878] [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe B (start=92445 end=92446) time 174 us, min 1073, max 1079, scanline start 1068, end 1079
しかしながら、そもそも dmesg のオプションに、所望の機能があるのではないかと、ヘルプを見てみたら。。。ありました。
[root@hoge ~]# dmesg -e
...
[11月27 21:46] IPv6: ADDRCONF(NETDEV_UP): wlp4s0: link is not ready
[11月27 21:47] [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe B (start=92367 end=92368) time 177 us, min 1073, max 1079, scanline start 1069, end 1077
[  +1.300006] [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe B (start=92445 end=92446) time 174 us, min 1073, max 1079, scanline start 1068, end 1079
知らなかった。/var/log/messages を見て、対応する行を探してました。この機会に、頭のノートにメモっておこう。

0 件のコメント:

コメントを投稿

人気ブログランキングへ にほんブログ村 IT技術ブログへ