Deployment Architecture

Splunk DB Connect 1: How to restrict dbquery results from an MSSQL database to the range selected in the time picker?

duffeysplunk
Path Finder

I have created a dashboard that has a few filters on it which are used to retrieve specific rows from the MSSQL database. I have managed to substitute the filters into the query, except a timepicker filter is proving more difficult. I want to restrict the query results to the range selected in the time picker rather than retrieving all the data and filtering it afterwards. Ideas on how to do this (besides indexing the data)?

I could use either epoch time or a datetime.

Splunk 6.3
DBConnect v1.2.1

0 Karma
1 Solution

woodcock
Esteemed Legend

You can gain access to the timepicker values by using addinfo and piping this through to a subsequent search using map like this:

| noop | stats count AS createOneEventToAttachAddInfo| addinfo | map search="|dbquery Your SQL Stuff With $info_min_time$ or $info_max_time$ or both"

View solution in original post

0 Karma

woodcock
Esteemed Legend

You can gain access to the timepicker values by using addinfo and piping this through to a subsequent search using map like this:

| noop | stats count AS createOneEventToAttachAddInfo| addinfo | map search="|dbquery Your SQL Stuff With $info_min_time$ or $info_max_time$ or both"
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 ...