Splunk Search

How do I compare results from 2 indexes on a common field?

mwdbhyat
Builder

Hi guys,

Has anyone ever written a search that can compare events(in this case "indicator" across 2 indexes and show them in separate tables side by side? EG search(that doesn't work):

index=ironport
| rename url AS indicator
| join indicator [search index=crowdstrike* type=url earliest=0 | spath output=myfield path=relations.indicator{}.type{} | table indicator, type, ip_address_types, labels_name,malware_families]
| table indicator

I'm basically looking for common "indicator" fields between two indexes, which would then be presented in a table.
Any thoughts on this?

Thanks!

Tags (1)
0 Karma
1 Solution

woodcock
Esteemed Legend

Stop using join; try this:

index=ironport OR (index=crowdstrike* type=url earliest=0)
| spath output=myfield path=relations.indicator{}.type{}
| table indicator, type, ip_address_types, labels_name,malware_families)
| eval indicator = coalesce(indicator, url)
| stats dc(index) AS indexCount BY indicator
| search indexCount>1

View solution in original post

0 Karma

woodcock
Esteemed Legend

Stop using join; try this:

index=ironport OR (index=crowdstrike* type=url earliest=0)
| spath output=myfield path=relations.indicator{}.type{}
| table indicator, type, ip_address_types, labels_name,malware_families)
| eval indicator = coalesce(indicator, url)
| stats dc(index) AS indexCount BY indicator
| search indexCount>1
0 Karma

mwdbhyat
Builder

Thanks that did what I wanted

0 Karma

woodcock
Esteemed Legend

It will probably be more efficient if you drop the | table line or switch to | fields. Try that and compare.

0 Karma

ssadanala1
Contributor

You can try some this like this

index=ironport
| rename url AS indicator |appendcols [search index=crowdstrike* type=url earliest=0 | spath output=myfield path=relations.indicator{}.type{} | table indicator, type, ip_address_types, labels_name,malware_families]| stats values(*) as * by indicator

0 Karma
Get Updates on the Splunk Community!

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

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...