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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...