I would like convert my Centos 6.10 dmesg in real timestamp, how do I do this? I tried with -T but no luck. I have long entry like (1630230907.320:2)
Asked
Active
Viewed 545 times
1 Answers
0
When neither the -T
and/or --ctime
flags to print human-readable timestamps are supported, you can manually convert the timestamp.
The timestamp in dmesg
is the offset in seconds since last reboot so :
Determine the last reboot:
[root@server ~]# last -n 1 reboot reboot system boot 3.10.0-1160.76.1 Sat Aug 27 10:56 - 14:25 (29+03:28) wtmp begins Tue Nov 7 09:30:18 2017
For example my
dmesg
has an entry:[2316645.206965] BIOS EDD facility v0.16 2004-Jun-25, 1 devices found
Then use
date --date "[date of last-reboot] [timestamp] seconds
to convert the timestamp:date --date "Sat Aug 27 10:56 2316645.206965 seconds" Fri Sep 23 06:27:37 CEST 2022
Which corresponds exactly with
dmesg -T
:[Fri Sep 23 06:27:37 2022] BIOS EDD facility v0.16 2004-Jun-25, 1 devices found
I assume though that your time stamp is incorrect for some reason, 1630230907.32 seconds is over 50 years.
Reasons for incorrect timestamps are already given in the manual page man dmesg
-T, --ctime
Print human-readable timestamps.
Be aware that the timestamp could be inaccurate! The time
source used for the logs is not updated after system
SUSPEND/RESUME. Timestamps are adjusted according to current
delta between boottime and monotonic clocks, this works only
for messages printed after last resume.
Suspend/resume events are not only something that only concerns laptop users, virtual systems may also experience them during live migration for example.

diya
- 1,771
- 3
- 14