Splunk Search

Compare 2 multivalues fields for matching

Laxman24
Explorer

Hi all,

i need some help in comparing 2 fields, the other field has multi values,

Field 1Field 2
127.0.0.1127.0.0.1
127.0.0.2
127.1.1.1127.1.1.2
127.1.1.2127.1.1.3
127.1.1.4

 

I want to compare these 2 fields , when in field 1 has matching value with the field 2 it will return match in a new field im going to make, but in field 2 records isnt always has multi values, im expecting the result as below:

Field 1Field 2New_Field
127.0.0.1127.0.0.1
127.0.0.2
matched
127.1.1.1127.1.1.2not matched
127.1.1.2127.1.1.3
127.1.1.4
127.1.1.5
not matched

 

im still new with splunk search,

need some advice how i could do the compare and on multi values field as above

 

really appreciate if someone could help on this

 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| eval New_field=if(isnotnull(mvfind(Field2,Field1)),"Matched","not matched")

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| eval New_field=if(isnotnull(mvfind(Field2,Field1)),"Matched","not matched")

Laxman24
Explorer

@ITWhisperer  Thank you so much!!! this seems work!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...