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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...