Splunk Search

how to take the three values from one field result and table them

loudainmarc
Explorer

hi, my search is:
sourcetype:sys src_ip_groupname=list1 OR src_ip_groupname=list2 | table src_ip dest_ip src_ip_groupname
The problem is that src_ip_groupname has eg: IANA Reserved, CountryX,list1.
so my | table src_ip dest_ip src_ip_groupname is:
IP-1 IP-2 IANA Reserved,CountryX,list1
IP-3 IP-4 CountryY,list2
What i want is to | table src_ip dest_ip Assigned Country List
IP-1 IP-2 IANA Reserved CountryX list1
IP-3 IP-4 - CountryY list2
Thank you for help

Tags (2)
0 Karma
1 Solution

dineshraj9
Builder

Try extraction these fields with optional condition this way -

sourcetype:sys src_ip_groupname=list1 OR src_ip_groupname=list2 | rex field=src_ip_groupname "((?<Assigned>[^\,]+)\,)?(?<Country>[^\,]+)\,(?<List>[^\,]+)" | fillnull value="-" Assigned | table src_ip dest_ip Assigned Country List

View solution in original post

0 Karma

dineshraj9
Builder

Try extraction these fields with optional condition this way -

sourcetype:sys src_ip_groupname=list1 OR src_ip_groupname=list2 | rex field=src_ip_groupname "((?<Assigned>[^\,]+)\,)?(?<Country>[^\,]+)\,(?<List>[^\,]+)" | fillnull value="-" Assigned | table src_ip dest_ip Assigned Country List
0 Karma

loudainmarc
Explorer

absolutely majestic dineshraj thank you very much

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...