Getting Data In

How do I complete a search including common and unique data fields from two different sources?

jredsama
New Member

Hello,

I would like to run a query that includes results from our main index as well as an uploaded CSV. I don't think I want to join, as it seems to leave out the unique data fields/values.

Here's a made up example of what I mean:

Main index contains -
ID
time
amount
result

CSV contains -
ID
time
amount
rating

So what I'd like is to search the common fields 'ID', 'time' and 'amount' and receive all transactions (from both sources) that contain values for those fields AS WELL AS receive the unique fields 'result', 'rating' from each data source in a single search result.

Further simplified, I want to search ID= time= amount= and in my results see data from both sources, along with the fields 'result' and 'rating' where applicable.

Thanks in advance!

0 Karma

DalJeanis
SplunkTrust
SplunkTrust

At its most trivial, you want something like this

 ( search for event type 1) OR (search for event type 2) 
| fields _time time ID amount result rating
| stats values(*) as * by ID

For more complete description of what and why, look at martin_mueller's and my answers here -
https://answers.splunk.com/answers/561130/sql-analogy-for-my-log-search-join-two-tables-wher.html#an...

jkat54
SplunkTrust
SplunkTrust

You can do an outer join

 ...| join type=outer

Or you can load both sets of data in the pipe (best method)

 (index=mainIndex) OR (index=csvIndex)  ID=xyz time=xyz amount=xyz| ...
0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...