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!

What the End of Support for Splunk Add-on Builder Means for You

Hello Splunk Community! We want to share an important update regarding the future of the Splunk Add-on Builder ...

Solve, Learn, Repeat: New Puzzle Channel Now Live

Welcome to the Splunk Puzzle PlaygroundIf you are anything like me, you love to solve problems, and what ...

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...