All Apps and Add-ons

How to pass input field to DB Connect query?

sathish2k8
Explorer

I have SQL query for dashboard where by i have to input date through dashboard time filter? Please advise if this is possible.

SELECT TO_CHAR(date,
'DD-MON-YYYY HH24:MI') PER_MINUTE, count(*) FILE_COUNT,sum(count) TOTAL
FROM tableA
WHERE status = 2
AND name LIKE 'I%'
AND TO_CHAR(date,'YYYY-MM-DD HH24:MI') > '2018-04-30 23:59'
GROUP BY TO_CHAR(date, 'DD-MON-YYYY HH24:MI')
ORDER BY TO_CHAR(date, 'DD-MON-YYYY HH24:MI') desc;

0 Karma

muebel
SplunkTrust
SplunkTrust

Hi sathish2k8,

Yup, perfectly possible to create a form input for a dashboard and pass the values to a search. There is more info here:

http://docs.splunk.com/Documentation/Splunk/7.1.0/Viz/tokens

You'll likely have to adjust the format of the result time token through additional eval commands as demonstrated here: https://answers.splunk.com/answers/438999/dashboard-how-can-i-convert-a-token-from-a-time-pi.html

Once the token is in the correct format needed for the dbquery, then you'll run that final search

Please let me know if this helps!

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...