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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...