Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
jftr the timestamp are absolute numbers since boot and don't have anything to do with your system clock – Ulrich Dangel Sep 27 '12 at 9:53
up vote 2 down vote accepted

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.

share|improve this answer
  1. in /var/log/messages and /var/log/syslog, it's automatically converted to HRTS (human readable timestamp).

  2. With -T, dmesg can return you with the HRTS form of the kernel ring. Please look at man dmesg.
    You may make a cron script to get what you exactly want :
    every $PERIOD seconds, dmesg --ctime --read-clear >> mymessagesHRTS.log

  3. You may think in using :
    dmesg --console-off
    dmesg --ctime --decode --show-delta
    (Reference : dmesg from util-linux 2.20.1)

hth - Stéphane

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.