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!

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...

Announcing the 1st Round Champion’s Tribute Winners of the Great Resilience Quest

We are happy to announce the 20 lucky questers who are selected to be the first round of Champion's Tribute ...

We’ve Got Education Validation!

Are you feeling it? All the career-boosting benefits of up-skilling with Splunk? It’s not just a feeling, it's ...