-
-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to parse ISO8601-compliant timestamp with a colon in the timezone #1367
Comments
I really don't have time to do something like this, can you attach some logs please. |
Sure. I can provide a handful of logs that aren't super sensitive from my current project.
|
Which of these patterns were you expecting to match these logs? lnav/src/formats/java_log.json Lines 7 to 50 in f21517b
If I add the first line of your logs as a sample, I get this output:
It seems like a new regex needs to be added. Note that you can patch existing log formats. Would you like some help writing the regex? |
I would expect the jvm pattern to match. I'm comfortable with getting some help on the regex as well; I know that there's one additional box there (for some tracing) that isn't 100% conventional for most Java applications, but I think I was mostly lost on working around the timestamp. |
I've pushed a change that adds the following pattern that matches your logs: lnav/src/formats/java_log.json Lines 50 to 52 in 8b12222
However, I'm not totally sure about all the fields. For the 3rd column with the number If you can try it out and clue me in, that would be helpful. Thanks! |
I've installed the new log format using |
Here's the description of the format, @tstack. Please note, that some of the fields are optional. They're not shown by default. Spring Boot is the de facto standard for all enterprise Java development nowadays. https://docs.spring.io/spring-boot/reference/features/logging.html#features.logging.log-format |
It's taken a while, and I do apologize for my absence on this, but I have something that works in my environment. The basic thing I did was ignore the extra fields...since they're optional, not guaranteed to be there, and finicky to deal with in Regex altogether. Ultimately this may come back to bite me but for what I want to use lnav for now, this works with some tests that also help reinforce that. Thanks for the kick-start with the timestamp piece!
Tests here:
|
Hi @MakotoTheKnight, I am afraid your pattern is not complete. Please follow the link in my previous message and try to open in The highlighted fields in the screenshot below are optional.
|
Logger configs and patterns for reference:
|
@vitalca , I'm not clear what you mean by the regex not being "complete", since two of the three examples I place in the tests block in my response are directly referenced from that example page. My goal is not to comprehensively capture every group with this initial pass, it's to ensure that Spring Boot's logs are not captured as In spite of the fact that the application name is generally provided, it is not mandatory, and getting an optional regex for that to work reliably is a lot more finicky than it should be. The reason for that is how the groups are defined: the application name, application group, thread name and correlation ID are all captured in square brackets, and if one optional field is omitted but others are not, then that could mean that we're mis-capturing things. How would we be able to tell the difference between logs that present just a thread name and a correlation ID? (I have a use case like that so I tend to get burned by it) If you want to add on to the regex I've shared that can satisfy those additional requirements, then I'd encourage you to do so. For now though, I'd conjecture that this gets us just enough to where we need to start to then build on/improve on things. Or, maybe some more advanced work with scripts and reading the logs in after they land in SQLite might be more appropriate. |
I mean that I took your regexp and it does not match the example log from the documentation.
Of course, we can't cover all possible combinations, but at least the most common cases for the majority of
There you go:
|
I think you can just add custom rules to your local config for your own cases. |
As to this pattern in my solution,
ISO 8601 allows the following date formats -
and the following time formats -
and the following zone designators -
|
Ah, yes, I've made the correlation ID optional in this commit: 4d624f5 I'd need some example logs where the app group is set. Sorry for not getting back, I got obsessed with some performance improvements. |
lnav version
v0.12.3
Describe the bug
When using lnav against Java logs with a timezone that includes a colon, the parsing for it fails and reverts to using the generic log configuration. This eliminates the ability for me to use the logs, or causes to logs to "appear" out of sync to lnav if I aggregate more than one file together.
To Reproduce
I'm thinking about some pre-processing to do a workaround in lnav but would think that this should be addressed at the root.
The text was updated successfully, but these errors were encountered: