tstack / lnav

Log file navigator
http://lnav.org
BSD 2-Clause "Simplified" License
7.85k stars 313 forks source link

dmesg format #878

Open bonnefoi opened 3 years ago

bonnefoi commented 3 years ago

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."
            }
tstack commented 3 years ago

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.

Congee commented 1 year ago

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