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 Forwarders and Forced Time Based Load Balancing

Splunk customers use universal forwarders to collect and send data to Splunk. A universal forwarder can send ...

NEW! Log Views in Splunk Observability Dashboards Gives Context From a Single Page

Today, Splunk Observability releases log views, a new feature for users to add their logs data from Splunk Log ...

Last Chance to Submit Your Paper For BSides Splunk - Deadline is August 12th!

Hello everyone! Don't wait to submit - The deadline is August 12th! We have truly missed the community so ...