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!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...