Splunk Search

field extraction using regex - removing curly brackets

jaydiare
Explorer

I wonder if anybody can help me  with a regex to break this field into single lines 

 

CustomResults="{pcap_filter_result {72038003 Ok (0x00000000)}} {pcap_filter_result {1769863 Ok (0x00000000)}} {pcap_filter_result {10879463 Ok (0x00000000)}} {pcap_filter_result {1962188 Ok (0x00000000)}} {pcap_filter_result {69603350 Ok (0x00000000)}} {pcap_filter_result {22006889 Ok 

I am only interested to have : 72055288 Ok (0x00000000) 

is there any way I can see it match line by line with any other field?  like 

field 1 field 2 72055288 Ok (0x00000000) 

field 1 field 2 72055289 Ok (0x00000000) 

field 1 field 2 72055210 Ok (0x00000000) 

this one field has all this data together and looking for the best way to break it

 

thanks so much

 

Labels (2)
Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| rex max_match=0 "\{pcap_filter_result\s{(?<filter>[^\}]+)\}\}"
| mvexpand filter

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| rex max_match=0 "\{pcap_filter_result\s{(?<filter>[^\}]+)\}\}"
| mvexpand filter

jaydiare
Explorer

thank you this one worked!

0 Karma

javiergn
Super Champion

Hi,

There are several ways to achieve this. Assuming I understood your question correctly, the following SPL should do the job:

| makeresults
| eval CustomResults = "{pcap_filter_result {72038003 Ok (0x00000000)}} {pcap_filter_result {1769863 Ok (0x00000000)}} {pcap_filter_result {10879463 Ok (0x00000000)}} {pcap_filter_result {1962188 Ok (0x00000000)}} {pcap_filter_result {69603350 Ok (0x00000000)}}"
| rex field=CustomResults max_match=0 "pcap_filter_result \{(?<fields>\d+ [^\}]+)"
| mvexpand fields
| rex field=fields "(?<field1>\d+) (?<field2>.+?)$"

Example from my lab:

Screenshot 2021-05-18 at 18.15.21.png

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...