
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Flex Connector One Regex per line
Hi,
I would like to know if it is possible to have a one regex statement to match keys in a log event per line ?
The order of keys in log events is not consistent and not all keys are present in all log messages. I know I can add optional regex match but there are too many variables and keys to deal with. The sample below is just an illustration for my question.
Sample:
id=123 staticvalue firstname="Foo" lastname="bar" age="22" location="Somwhere" pkey="123456"
id=124 staticvalue firstname="Blah" lastname="Whew" age="52" pkey="123456" location="Anywhere"
id=124 staticvalue firstname="Blah" pkey="123456" location="Anywhere" age="52"
I tried creating submessage id and restofmessage but I do not see the keys/values I am parsing.
id=(\d+) (staticvalue) (.*)
My submessage is anything between (*)
I now want to have multiple submessage patterns like:
submessage[0].pattern[0]
firstname="([^"]+)"
#assign key if exists
submessage[0].pattern[1]
lastname="([^"]+)"
#assign key if exists
submessage[0].pattern[2]
age="([^"]+)"
#assign key if exists
submessage[0].pattern[4]
location="([^"]+)"
#assign key if exists
submessage[0].pattern[5]
pkey="([^"]+)"
#assign key if exists
Is it possible to acheive regex match this way on a flex connector file ?
Thanks,