-
I have basic in a NodeJs/Bun app with Winston. The logs have a {"level":"info","message":"Starting app..","timestamp":1737471791303}
{"level":"debug","message":"COMMAND loadfile\n","requestId":8460,"timestamp":1737471792371}
{"0":"{\"data\":{\"playlist_entry_id\":1}","level":"debug","message":"Command: loadfile","timestamp":1737471792372} I tried it with a schema like this, however it just doesnt get applied. {
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
"moo_log": {
"title": "Moo Json log",
"description": "",
"url": "",
"file-type": "json",
"level-field": "level",
"timestamp-field": "timestamp",
"body-field": "message",
"line-format": [
{
"field": "createdAt"
},
{
"prefix": " ",
"field": "level"
},
{ "field": "message" }
],
"value": {
"message": { "kind": "string" },
"createdAt": { "kind": "integer" },
"level": { "kind": "string" }
},
"sample": [
{
"line": "{\"timestamp\":1737407223914,\"level\":\"debug\",\"message\":\"mpv data\"}",
"level": "debug"
},
{
"line": "{\"timestamp\":1737407223914,\"level\":\"xx\",\"message\":\"mpv data\"}",
"level": "debug"
}
]
}
} What am I doing wrong? Also #454 would be so nice to get feedback on the process |
Beta Was this translation helpful? Give feedback.
Answered by
tstack
Jan 21, 2025
Replies: 1 comment 1 reply
-
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
vdawg-git
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's working for me on lnav v0.12.3:
I copied your format file and ran
lnav -i
to install it.What version of lnav are you using?
You can run lnav with
-d /tmp/lnav.dbg
to have lnav write a debug log. There's some more details about what is going on there. In the "Files" panel in the TUI, you can pressCTRL-]
to focus on the details view to get some other details.Some notes on the format:
timestamp-divisor
to 1000 since it looks like thetimestamp
value is milliseconds since the epoch.createdAt
field in the sample logs, but it's mentioned in the format.