Utility for printing dmesg/kmsg/printk timestamps, taking into account drift.
Project description
Utilities to view kmsg/printk/dmesg timestamps in local time and date, UTC, or epoch seconds, which account for drift.
The printk clock drifts, often a lot, from the local clock (the one ntp feeds). This can cause radically different and incorrect values if directly converted (like with dmesg -T available on some dmesg). This application supports noting and marking drift and using that to calculate much more accurate timestamps.
Applications
dmesg_format_dates - This application runs “dmesg” (or you can pipe in a pre-recorded dmesg, e.g. from logs) and uses the calculated drifts to derive accurate timestamps. If outside of the threshold (default 12000 seconds), a new drift marker will be added.
printk_time_convert - This application takes a single timestamp and converts it to either a local ctime, utc ctime, or epoch timestamp. It will add a drift note if a recent one is not available.
TODO: Finish documentation
How can I configure my kmsg to log timestamps?
Set the value of /sys/module/printk/parameters/time to “Y” (e.x. echo “Y” > /sys/module/printk/parameters/time)
Sample
Here is a sample showing the inaccuracies that can creep in:
First, show that dmesg can’t handle the printk drift
[media@silverslave printk-timestamp-formatter]$ date; sudo bash -c ‘echo “Hello World” > /dev/kmsg’; dmesg -T | grep ‘Hello World’ | tail -n1
Wed Sep 9 01:13:56 EDT 2015
[Wed Sep 9 01:14:31 2015] Hello World
Next, show that dmesg_format_dates does work with the printk drifts
[media@silverslave printk-timestamp-formatter]$ date; sudo bash -c ‘echo “Hello World” > /dev/kmsg’; ./dmesg_format_dates | grep ‘Hello World’ | tail -n1
Wed Sep 9 01:14:11 EDT 2015
[Wed Sep 9 01:14:11 2015] Hello World
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file printk-timestamp-converter-2.1.0.tar.gz
.
File metadata
- Download URL: printk-timestamp-converter-2.1.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6a7d2f0394e6a40302ee2bbbb6d53cb38e96fbee05cf6687afdc1da4b0bce89 |
|
MD5 | bbeb947911a56d50cb52c88e6a4391c8 |
|
BLAKE2b-256 | 9aeca0ec514b058a88373c6e594129c110b626e60756518c7d3eb24b7184e175 |