Splunk Search

field extraction from some multivalued fields seperated by comma

christythomas
Explorer

Log event x: This is the name of the group#2 target(s) [name3]
Log event y: This is the name of the group#1 target(s) [name1,name2]

just omitted other parts of log including time-stamp.
how to extract all the names to one field "members" to produce a table group , members
not able to extract the second field, i a not good in regular expressions and couldn't find a way..
Any help will be appreciated

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Two steps: First, extract the stuff between the brackets. Second, do a repeated match on the parts separated by commas:

... | rex "\[(?<members>[^\]]+)\]" | rex field=members max_match=0 "(?<members>[^,]+)"

Lowell
Super Champion

Don't forget about the simplicity of the mighty eval command:

... | rex "\[(?<members>[^\]]+)\]" | eval members=split(members, ",")
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...