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!

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 ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...