Splunk Search

Splunk DB Connect: How to log results of dbquery?

dr_juice
Explorer

I've connected to an MS SQL database using DB Connect and have a query running that successfully extracts table data. My question is I only get the results of the current query and do not see any events of past queries.

Basically, I want to log the number of active users of an application over time. Other than dumping the query to a text file, and then using that as a secondary input, is there a way to do it with my current SQL query?

0 Karma
1 Solution

dr_juice
Explorer

I've figured it out by creating a new index and adding a connect statement to the query and referencing the new index name.

| collect index= sourcetype=

They're small outputs (ie. less than 50 rows per query) so I don't think performance is being impacted.

View solution in original post

0 Karma

dr_juice
Explorer

I've figured it out by creating a new index and adding a connect statement to the query and referencing the new index name.

| collect index= sourcetype=

They're small outputs (ie. less than 50 rows per query) so I don't think performance is being impacted.

0 Karma

pmdba
Builder

Check the documentation for DBConnect. You can create a SQL-based input and index the results just like any other input.

0 Karma

dr_juice
Explorer

Yes, thanks. My difficulty was applying the documentation to my needs.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...