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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

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

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