Dmesg with real time

Is it possible to display dmesg with real time instead of the default secs?

TIA

Greg

Hi

using the “real” dmesg command, the “-T” option displays the timestamp.
But it’s not available with Busybox’s dmesg…

You can pipe the output of dmesg to a Python script : https://linuxaria.com/article/how-to-make-dmesg-timestamp-human-readable

Thanks for the suggestion, however that python script is giving the following errors:

Traceback (most recent call last):
File “./pydmesg”, line 20, in
_dmesg_line_regex = re.compile("^[(?P<time>\d+.\d+)](?P<line>.*)$")
File “/usr/lib/python2.7/re.py”, line 194, in compile
File “/usr/lib/python2.7/re.py”, line 251, in _compile
sre_constants.error: unknown specifier: ?P&

You can use the dmesg-command from entware.
The dmesg from busybox /usr/bin/dmesg) does not support the -T flag.

Do in a ssh-shell:

installentware
opkg install dmesg

This installs dmesg in /opt/bin/dmesg and -T is supported.

If it is a new entware-installation you have perhaps to logout and login again
to refresh your search-PATH

Hope that helps.

Peter

1 Like

Thanks, works like a dream.