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.

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

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...