lnav icon indicating copy to clipboard operation
lnav copied to clipboard

dmesg format

Open bonnefoi opened this issue 4 years ago • 2 comments

lnav version v0.8.5

I try to make a format for the dmesg command :

$ dmesg -x
kern  :notice: [    0.000000] Linux version 5.4.0-77-generic (buildd@lgw01-amd64-028)
...

I'm running into the following bug displaying the date :

dmesg -x | lnav
kern  :notice: [    6284-09-07 22:16:56.000000] Linux version 5.4.0-77-generic (buildd@lgw01-amd64-028)

My format:

"pattern" : "^(?<module>[^:\\s]*)\\s*:(?<level>[^:\\s]*)\\s*: \\[\\s*(?<timestamp>\\d+\\.\\d{6})\\] (?<body>.*)$"
"timestamp-format" : [ "%s.%f" ],
        "sample" : [
            {
                "line" : "kern  :warn  : [   12.233441] VBoxNetAdp: Successfully started."
            }

bonnefoi avatar Jun 29 '21 21:06 bonnefoi

Hmm, on the latest version, the timestamp is not accepted because it is zero:

error:dmesg_log:invalid sample -- kern  :notice: [    0.000000] Linux version 5.4.0-77-generic (buildd@lgw01-amd64-028)
error:dmesg_log:unrecognized timestamp format -- 0.000000] Linux version 5.4.0-77-generic (buildd@lgw01-amd64-028)
  format: %s.%f; matched: 0

I'm not quite sure I remember why zero is not allowed... I'll revisit this, thanks for raising it.

tstack avatar Jun 30 '21 05:06 tstack

related to https://github.com/tstack/lnav/issues/481

Congee avatar Nov 28 '22 08:11 Congee