Splunk Search

How to write a search to determine if the value of one field is found in the value of another field?

olheiser01
New Member

I am trying to return a result when one field contains another. For example,

field1="ABCDEFG"
field2="CDE"

Match= True

I wanted to try something similar to where like(field1, %field2%), but I'm not sure how to make that happen as field2 is a variable.

0 Karma

sundareshr
Legend

Try creating a new var with the pattern. Like this ... | eval pattern="%".field2."%" | where like(field1, pattern)

somesoni2
SplunkTrust
SplunkTrust

You can just use it in place, new field creation not required.

... | where like(field1, "%".field2."%")
0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...