-
-
Notifications
You must be signed in to change notification settings - Fork 374
Description
lnav version
v0.11.1
Describe the bug
Running into this issue when trying to create a custom log format for Java Tomcat logs.
I believe this is similar to the other multi-line issues, but with a twist. I'm able to use a multi-line RegEx in my custom log format and it seems to work properly (after making subsequent lines optional as per this comment), except the <level> field is not mapped to log_level when <level> does not appear on the first line of the message.
"regex" : {
"basic" : {
"pattern" : "^(?<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z)>>(.*?(?<level>\\w+)>>(?<component>\\w+)>>(?<body>.*))?$"
}
},
This works, and correctly identifies the various fields:

However, lnav does not correctly apply the appropriate log level (i.e. error and warning messages are not highlighted). A SQL query shows that the log_level for all three messages is "info":
Contrast this with a similar example, except with the <level> field on the first line of the message:
"regex" : {
"basic" : {
"pattern" : "^(?<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z)>>(?<level>\\w+)>>(.*?(?<component>\\w+)>>(?<body>.*))?$"
}
},
In this case the error lines are correctly highlighted:
And an SQL query shows that the log_levels are correctly applied:


