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
Revered Legend

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

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

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...