Splunk Search

i want to iterate values a field from one source type and compare each values with set of values in another field of different sourcetype

New Member


I have two sourcetype A and B where sourcetype A has field A1 and sourcetype B has field B1.

My base query is something like index=test (sourcetype= A OR sourcetype=B)

A1 which belongs to sourcetype A has below values.


B1 which belogs to sourcetype B has below values


All i want to do is iterate field A1 and start comparing it with each values in B1 and see which two values are equal and record the corresponding events in A1 using eval statement with separate field Hit and have the value as matching OR not matching

the comparison is something like 1 with 11 , 1 with 12 , 1 with 4 , 1 with 56 , 1 with 7 and 1 with 10. The next comparision is like 4 with 11 , 4 with 12 , 4 with 4 now this is a hit so i record HIT value for this event in source type A1 under seperate field.

I did a logic with transaction command along with coalesce , but it does not suit my requirement due to some factors . I want to do it in some other way. kindly assist.

0 Karma



From your requirement, you have a common field in both sourcetypes and want to get the events from sourcetype A if there is a matching value in sourcetype B. Assuming the field name as ID

try with stats and lets know what's missing

 index=test (sourcetype=A OR sourcetype=B)
 |stats values(sourcetypeA_filed1 ) as sourcetypeA_filed1 , ............
        values(sourcetypeA_filedn ) as sourcetypeA_filedn ,dc(sourcetype) as c by ID|where c>1
Happy Splunking!
0 Karma
Get Updates on the Splunk Community!

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 ...

March Community Office Hours Security Series Uncovered!

Hello Splunk Community! In March, Splunk Community Office Hours spotlighted our fabulous Splunk Threat ...

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

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars in April. This post ...