Splunk Search

Extract fields from a list

shashank111v
Explorer

How to extract values from below log file using rex?

Log:

{Attribute(name=xyz, values={'1'}), Attribute(name=attempts, values={'2'}), Attribute(name=Count, values={'0'}), Attribute(name=MemberNumber, values={'31234'})}

 

Result in table:

1 2 0 31234

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| rex max_match=0 "\{\'(?<value>[^\']+)\'\}"
| eval name=mvindex(value,0)
| eval attempts=mvindex(value,1)
| eval count=mvindex(value,2)
| eval membernumber=mvindex(value,3)

View solution in original post

shashank111v
Explorer

Thank you! But I want to extract four different columns with  values related to it.

Name attempts  count membernumber

1                        2       0         31234

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex max_match=0 "\{\'(?<value>[^\']+)\'\}"
| eval name=mvindex(value,0)
| eval attempts=mvindex(value,1)
| eval count=mvindex(value,2)
| eval membernumber=mvindex(value,3)

ITWhisperer
SplunkTrust
SplunkTrust
| rex max_match=0 "\{\'(?<value>[^\']+)\'\}"
0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud's AI Assistant in Action Series: Auditing Compliance and ...

This is the third post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...