Deployment Architecture

How to combine a Splunk search and |dbquery into one chart?

mbuschle
Explorer

I need some help to get data from a search and the |dbquery command. Basically I would like to create a multi-series chart that shows data that must be pulled from a search and from the |dbquery command. It's a count of unique users for two different systems (one that's on the way out and one on the way in). The data for the old system is available to be pulled from Splunk data via a search. The new data is in a database. So ultimately I'd like to have a search that would look like this:

sourcetype=OldDataLogins |dbquery "newdata" "select UniqueUsers from table" | ...

I'd then run it through stats or timechart to allow me to put the two series into one chart. The problem is I'm not sure that there is a way to combine a search and dbquery. Any help would be appreciated.

1 Solution

somesoni2
Revered Legend

You can use append to combine two result sets. Have the query with smaller result set to be used in subsearch

sourcetype=OldDateLogins | append [|dbquery "newdata" "select UniqueUsers from table"] | ...your aggregation command...

View solution in original post

somesoni2
Revered Legend

You can use append to combine two result sets. Have the query with smaller result set to be used in subsearch

sourcetype=OldDateLogins | append [|dbquery "newdata" "select UniqueUsers from table"] | ...your aggregation command...
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...