Splunk Search

What is the best way to join a row with rows in another table?

Buscatrufas
Path Finder

Hi guys,

I need to create a join with a row, and this row has multiple occurrences in another table. What is the best way to do this?

Thanks!

0 Karma

woodcock
Esteemed Legend

Like this:

(index=indexA sourcetype=sourcetypeA) OR (index=indexB sourcetype=sourcetypeB) | stats values(*) AS * BY MyCommonField
0 Karma

Richfez
SplunkTrust
SplunkTrust

Can you please include a couple of each "side" of the events that need to be joined together? And how do they fit together?

I'll also mention that it's pretty rare to actually need join itself, there is usually a much faster, easier method.

For instance,

sourcetype=A OR sourcetype=B | stats list(_raw) by MyCommonField

Now that's a terrible example because you likely don't want to list(_raw) in the output, but it is nevertheless an example. 🙂

It would pull up all events that match either sourcetype (think SQL union), then the stats command would essentially group them together by the common field, whatever that is, doing what most folks consider a "join".

0 Karma
Get Updates on the Splunk Community!

AppDynamics Summer Webinars

This summer, our mighty AppDynamics team is cooking up some delicious content on YouTube Live to satiate your ...

SOCin’ it to you at Splunk University

Splunk University is expanding its instructor-led learning portfolio with dedicated Security tracks at .conf25 ...

Credit Card Data Protection & PCI Compliance with Splunk Edge Processor

Organizations handling credit card transactions know that PCI DSS compliance is both critical and complex. The ...