Skip to content
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

Nested parenthesis cannot be parsed; seems pattern has no concept of nesting and will end prematurely #16

Open
WesternGun opened this issue Jan 9, 2023 · 2 comments

Comments

@WesternGun
Copy link

WesternGun commented Jan 9, 2023

I have logs lines with (%t) like:

(Camel (camel-1) thread #17 - Split)

or

(Camel (camel-1) thread #4 - JmsConsumer[my.queue])

I see that chainsaw will stop parsing the thread name at the first right parenthesis, and consider the rest as next token. I think it should consider the levels and save them in a stack, sth like:

  • push the left parenthesis into a stack
  • whenever it sees a right parenthesis, pops out a left paring one
  • if stack is not empty, continue parsing this token.

Now the workaround is to change the log format to be like -{%t}-, and configure chainsaw to be the same. That is fine at dev time, but will not solve production issue when the format is fixed.

@rm5248
Copy link
Contributor

rm5248 commented Jan 9, 2023

Do you need to parse text lines? The version of chainsaw in master(likely somewhat unstable) does have some initial support for JSON based log messages, which would bypass this problem.

@WesternGun
Copy link
Author

WesternGun commented Jan 10, 2023

No, this is not a JSON log, but text lines. I could change Quarkus to output JSON format, but I would rather not; and I need to analyze other applications' logs which are not Quarkus based and they only have text line logs(cannot use JSON).

I think even for plain text logs, this should be checked. But I agree that things would become complicated as you may need to do this stack pop/push whenever you see a parenthesis/bracket/curly bracket in the pattern, in each field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants