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!

Splunk App for Anomaly Detection End of Life Announcement

Q: What is happening to the Splunk App for Anomaly Detection?A: Splunk is officially announcing the ...

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...