Splunk Search

I have two string fields in the event. I want to extract what is not present in the second string by comparing with first string

jaishinmp
New Member
  1. key1="a,b,c"
  2. key2="c,a"
Tags (2)
0 Karma

niketn
Legend

Following is a run anywhere search based on your example. First two pipes create data as per your example. You can replace with your own query to get fields key1 and key2 in a table and then apply the code from third pipe onward (i.e. from makemv command):

|  makeresults
|  eval key1="a,b,c", key2="c,a"
|  makemv key1 delim=","
|  makemv key2 delim=","
|  mvexpand key1
|  eval flag=case(match(key2,key1),"found",true(),"missing")
|  search flag=missing
|  fields - flag key2

PS: You can test by removing final two pipes i.e. search and fields command to understand how query is matching key1 inside key2.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
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 ...