Custom format for multi-line log entries with multiple patterns matches only one pattern #816
Replies: 5 comments 6 replies
-
lnav will only match the first line of the log message when picking a pattern. Since it looks like your patterns all have the same pattern for the first line, it's not going to figure out which one to use. I would suggest combining the patterns into a single one using an alternate (e.g. |
Beta Was this translation helpful? Give feedback.
-
I've pushed a change that adds an ;SELECT * FROM xpath('/a-request/source', msg_data); I added your test log file and a format to the source and it seems to work. (I still have to write a test that uses that stuff) |
Beta Was this translation helpful? Give feedback.
-
I thought I understood things, but this discussion indicates that I don’t. BRgds/Alan |
Beta Was this translation helpful? Give feedback.
-
Thanks Tim ... "regex has only the first line of the message to match" ... do you mean carriage return delineated lines ? I am dealing with a pfSense firewall log and every message in the log is a single line long, separated by the normal end-of-line for OS. So every message line should be unique and matched against one of the unique regex ? In my case it doesn't seem to work like this, it picks one regex to match and then seems to ignore the others. Examples of the possible (I think) message formats given below (everything within the quotes is a single line in the log file). "Mar 18 10:51:53 computer.domain.tld filterlog: 5,,,1000000103,igb0,match,block,in,4,0x0,,41,4812,0,none,6,tcp,44,111.22.33.1,224.22.11.1,39248,10443,0,S,980905229,,1024,,mss" BRgds/Alan |
Beta Was this translation helpful? Give feedback.
-
I defined custom format with three patterns (request, reply, generic). When opening a test log file (below) I see all lines are matched only by "generic" pattern although some of them should much "request" or "reply" patterns (tested at regex101.com).
What am I missing?
custom format:
test log file:
Beta Was this translation helpful? Give feedback.
All reactions