Non-greedy string specifier in the Pattern parser?


Author
Message
Zoltan Kelemen
Zoltan Kelemen
Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)
Group: Forum Members
Posts: 21, Visits: 97
Hi,

I was wondering if it would be possible to add an option to %S - or perhaps have another string specifier - that would act non-greedy, i.e. match the first occurrence of the following separator, not the last?

i.e. I have the following line, say

2022-05-12T19:21:25.065+0200; DEBUG; hostname123; P4216/T31; [Component]; Conversation state changed: ACTIVE -> ACTIVE. Call leg state changed: CallLegStateChange[ACTIVE->ACTIVE for callLeg: CallLeg [2c8a32f9066d396540b7024414c86fe8@1.2.3.4 -- D-638b5c9f-b60e-4d55-9544-cdbc51b5cd06] state: ActiveState@4b9f5055, status=UnknownStatus@2fb72ab2, additionalData=null];

And I'd like to parse this with:
%d{yyyy-MM-ddT%H:mm:ss.fffzzzz}; %p; %c; %t; [%S{Component}]; %S{Action}: %m%n

Where I'd want the Action field to be "Conversation state changed"

I can't really seem to make this work with a Pattern Parser.
Probably could either do a custom parser, or a regex parser, but I was thinking this feature may be a useful addition to the simple pattern parser as well.

Thanks,
  Zoltan

LogViewPlus Support
LogViewPlus Support
Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)
Group: Moderators
Posts: 1.1K, Visits: 3.7K
Hi Zoltan,

The example provided seems to work as you would expect:


It is not clear what you are trying to achieve, but I suspect the problem you are having may be related to the other log entries in the file.  LogViewPlus does not support parsers with optional arguments, but you may want to experiment with multi-patterns.  These allow you to apply multiple parsers to the same log file.

Hope that helps,

Toby
Zoltan Kelemen
Zoltan Kelemen
Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)Gaining Respect (103 reputation)
Group: Forum Members
Posts: 21, Visits: 97
Oh, burn BigGrin
I was hoping I can come up with a simple example, but haven't tested it myself. BigGrin
You are perfectly right, and my problem was that I was already using a multi-parser, and a different pattern line matched in my real-life scenario, rather than which I was expecting to match.

Sorry for the confusion created.


LogViewPlus Support
LogViewPlus Support
Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)Supreme Being (5.3K reputation)
Group: Moderators
Posts: 1.1K, Visits: 3.7K
No worries Zoltan - glad that helped.  :-)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Login

Explore
Messages
Mentions
Search