[formats] add rust env_logger and simple_logger formats

pull/1285/head
Tim Stack 2 months ago
parent c879b2a690
commit 732e0e824e

@ -34,9 +34,11 @@ Features:
* Keymap definitions can now bind to a function key using an
identifier that starts with `f` followed by the number of the
function key.
* Added log formats for the `env_logger` and `simple_logger` Rust
crates.
Interface Changes:
* The "Gantt Chart" view has been renamed to "timeline".
* The "Gantt Chart" view has been renamed to "timeline."
* In the timeline view, pressing `ENTER` will focus on
the preview pane, so you can scroll through messages
with the selected Op ID.

@ -84,7 +84,7 @@ Creating a Format Using Regex101.com (v0.11.0+)
For plain-text log files, the easiest way to create a log format definition is
to create the regular expression that recognizes log messages using
https://regex101.com . Simply copy a log line into the test string input box
on the site and then start editing the regular expression. When building the
on the site and then start editing a PCRE2 regular expression. When building the
regular expression, you'll want to use named captures for the structured parts
of the log message. Any raw message text should be matched by a captured named
"body". Once you have a regex that matches the whole log message, you can use

@ -13,6 +13,7 @@ FORMAT_FILES = \
$(srcdir)/%reldir%/dpkg_log.json \
$(srcdir)/%reldir%/elb_log.json \
$(srcdir)/%reldir%/engine_log.json \
$(srcdir)/%reldir%/env_logger_log.json \
$(srcdir)/%reldir%/error_log.json \
$(srcdir)/%reldir%/esx_syslog_log.json \
$(srcdir)/%reldir%/fsck_hfs_log.json \
@ -33,6 +34,7 @@ FORMAT_FILES = \
$(srcdir)/%reldir%/procstate_log.json \
$(srcdir)/%reldir%/rails_log.json \
$(srcdir)/%reldir%/redis_log.json \
$(srcdir)/%reldir%/simple_rs_log.json \
$(srcdir)/%reldir%/snaplogic_log.json \
$(srcdir)/%reldir%/sssd_log.json \
$(srcdir)/%reldir%/strace_log.json \

@ -0,0 +1,32 @@
{
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
"simple_rs_log": {
"title": "simple_logger format",
"description": "Format file for Rust's simple_logger crate",
"url": [
"https://docs.rs/simple_logger/latest/simple_logger/"
],
"regex": {
"std": {
"pattern": "^(?<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{9}[^\\s]+)\\s+(?<level>\\w+)\\s+\\[(?<module>\\w+)\\]\\s+(?<body>.*)$"
}
},
"value": {
"level": {
"kind": "string"
},
"module": {
"kind": "string",
"identifier": true
},
"timestamp": {
"kind": "string"
}
},
"sample": [
{
"line": "2022-01-19T17:27:07.013874956Z WARN [logging_example] This is an example message."
}
]
}
}
Loading…
Cancel
Save