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!

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...