3

I am getting my dmesg messages like this,

[   27.154743] uvcvideo: Found UVC 1.00 device Integrated_Webcam_HD (0c45:6a04)
[   27.194956] usbcore: registered new interface driver uvcvideo

But, I would like dmesg log messages to be printed in the format,

[DD-MM-HH-mm] SYSTEM_HOSTNAME the-message-content-comes-here

On net, I am not seeing any /etc/dmesg properties that does this.

Any property that does this?

0

1 Answer 1

1

This one-liner will do, but I think there's more efficient way...

dmesg -T | perl -MSys::Hostname -pe 's/^\[(.*?)\]/$_=`date +[%d-%m-%H-%M] -d "$1"`;chomp;$_." ".&hostname/e'
1
  • @don_crissti I don't think there's better way than dmesg -T to get plausible timestamps from the original dmesg jiffies output, except ones written in kern.log using accurate time.
    – yaegashi
    Commented Sep 10, 2015 at 10:26

You must log in to answer this question.