dmesg
reads the Kernel log ring buffer. It doesn’t do timestamps. What you should do is configure syslog to grab the kernel logs from that buffer and send them to a file (if it isn’t already set to do so). Note, default CentOS 5.x syslog config sends kernel logs to /var/log/messages
, as I recall.
If you’d like to send all kernel (dmesg) logs to /var/log/kern.log
, using the default syslog daemon, you’d add a line like the following to /etc/syslog.conf
kern.* /var/log/kern.log