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!

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...