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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...