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!

Splunk Observability Cloud’s AI Assistant in Action Series: Analyzing and ...

This is the second post in our Splunk Observability Cloud’s AI Assistant in Action series, in which we look at ...

Elevate Your Organization with Splunk’s Next Platform Evolution

 Thursday, July 10, 2025  |  11AM PDT / 2PM EDT Whether you're managing complex deployments or looking to ...

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...