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

vkrishnachand
New Member

Hi

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.

1,4,5,7,8,9

B1 which belogs to sourcetype B has below values

11,12,4,56,7,10

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

renjith_nair
Legend

@vkrishnachand,

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
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

Almost Too Eventful Assurance: Part 1

Modern IT and Network teams still struggle with too many alerts and isolating issues before they are notified. ...

Demo Day: Strengthen Your SOC with Splunk Enterprise Security 8.1

Today’s threat landscape is more complex than ever. Security operation centers (SOCs) are overwhelmed with ...

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...