Splunk Search

Join DBConnect SQL query with other datasets

osherma
Explorer

Hello DB pros,

I'm using DBConnect to query a specific table in an Oracle DB (let's call it "oracle"), which has the column "FLOW_ID". In another dataset (let's call it simply "dataset"), which is NOT imported from a DB, contains the field FlowId.

What I wish to do is to JOIN the results of the DB query and the data from "datasets" where FLOW_ID=FlowId.

In SQL, it would probably look like this:
Select *
From oracle a, dataset b
Where a.FLOW_ID=b.FlowId

I've read about the JOIN function in Splunk documentation as well as in different blogs and previous questions (e.g here, but I couldn't find any information about joining a DB Query with other source types.

I've tried the following queries, but none seem to work:

#1 | dbquery "oracle" "SELECT * FROM sometable" | JOIN FLOW_ID [SEARCH sourcetype=dataset | rename FlowId as "FLOW_ID" | FIELDS FLOW_ID TIMESTAMP]

I suppose that since the fields names are different this doesn't won't work, so I also tried to rename dataset.FlowId into "FLOW_ID"

#2 | dbquery "Oracle" SELECT * FROM sometable" | append [SEARCH sourcetype=dataset | FIELDS ] | WHERE FLOW_ID=FlowId

Any help will be GREATLY appreciated - as you can see, I'm pretty stuck.

1 Solution

dstaulcu
Builder

is the data in oracle dimensional data or event data? if dimensional data and not rapidly changing, why not output the results of your dbquery to oracle to a lookup table? if the content in oracle is event data, is it feasible for you to index the data by tailing the table as an event source? I imagine it would be very slow to join very large data sets among indexers and remote data sources through dbquery at search time.

View solution in original post

0 Karma

dstaulcu
Builder

is the data in oracle dimensional data or event data? if dimensional data and not rapidly changing, why not output the results of your dbquery to oracle to a lookup table? if the content in oracle is event data, is it feasible for you to index the data by tailing the table as an event source? I imagine it would be very slow to join very large data sets among indexers and remote data sources through dbquery at search time.

0 Karma

osherma
Explorer

Thank you for your answer.
It is event data, and unfortunately, due to its size (hundreds of GBs), cannot be "dumped" into an event source .

I also assume that the queries will take time, but I still wonder how to write queries that work...any ideas?

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...