Splunk Search

How to do cross-app join?

DrColombes
New Member

In Splunk 4.3 I want to do a join of an regex-extracted variable A (belonging to app/sourcetype a) with a variable B (belonging to app/sourcetype b).

I've tried several variations of something like this:

sourcetype="a" < ... extracted search for variable A ...> | rename A as C | join C
[ | rename sourcetypeb:B as C ]

but can't quite get the right answer (an inner join). Note the use of the qualifier soucetypeb:B to define the subsearch variable B. At least Splunk isn't complaining about a syntax error, so I think I'm on the right track.

(The subsearch hasn't run up against the 60-second limit.)

Thanks for any help you can offer.

0 Karma

Stephen_Sorkin
Splunk Employee
Splunk Employee

The typical way to do a join in splunk is via disjunction and stats, rather than relational join. For example:

(sourcetype=a ...) OR (sourcetype=b ...)
| eval c=if(sourcetype=="a", field_a, field_b)
| stats values(x) values(y) values(z) by c

Of course, you probably want to use the appropriate aggregator in the stats, to pick the fields that you're interested in and combine the (possibly) several values in the right way.

Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...