Is there a way to change the format of timestamp in kernel logs?
It was something like
2012-08-27T8:54:35.939421+03:00 now, I also checked
sysctl -a | grep log, nothing found really.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
No, see the kernel code in
kernel/printk.c, it's hardcoded as:
sprintf(tbuf, "[%5lu.%06lu] ", (unsigned long) t, nanosec_rem / 1000)
All you can do is enable/disable that timestamp. You can have whatever reads
/proc/kmsg (syslog, klog...) add the timestamp itself.
/var/log/syslog, it's automatically converted to HRTS (human readable timestamp).
dmesg can return you with the HRTS form of the kernel ring. Please look at
You may make a cron script to get what you exactly want :
dmesg --ctime --read-clear >> mymessagesHRTS.log
You may think in using :
dmesg --ctime --decode --show-delta
(Reference : dmesg from util-linux 2.20.1)
hth - Stéphane