Splunk Search

Partial Matching

rsathish47
Contributor

Hi all,

How do we check field2 contains field1? Please help.

Field1 Value= CA6

Field2 Value= IA6,CA6,CA8,CA9,CA10,CA7,T7,I6,I7,I10,AP7,AP10

Thanks
Sathish R

Tags (2)
0 Karma
1 Solution

lguinn2
Legend

If Field2 is a multivalued field, this will work

yoursearchhere
| eval n=mvfind(Field2,Field1)
| eval FoundIt = if(isnotnull(n),True,False)

Otherwise, try this

yoursearchhere
| eval FoundIt = if(match(Field2,Field1),True,False)

For either of these solutions to work, Field1 cannot contain any regular expression special characters:

\ ^ $ . | ? * + ( ) [ {

View solution in original post

lguinn2
Legend

If Field2 is a multivalued field, this will work

yoursearchhere
| eval n=mvfind(Field2,Field1)
| eval FoundIt = if(isnotnull(n),True,False)

Otherwise, try this

yoursearchhere
| eval FoundIt = if(match(Field2,Field1),True,False)

For either of these solutions to work, Field1 cannot contain any regular expression special characters:

\ ^ $ . | ? * + ( ) [ {

rsathish47
Contributor

Thanks lguinn.. It worked 🙂

0 Karma
Get Updates on the Splunk Community!

Community Content Calendar, November Edition

Welcome to the November edition of our Community Spotlight! Each month, we dive into the Splunk Community to ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...