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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...