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!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...