All Apps and Add-ons

Passing a date to dbquery

obrienk
Explorer

Hi,
I would like to run a simple query against a database using splunk.
I would like to run the query as part of a dashboard.

The query is as follows:

| dbquery "DATEBASE_NAME" limit=1000 "select tr.* from schema.table tr where tr.date = '27-AUG-2014'

I would like the query to run against the date in question. So it would be like:

| dbquery "DATEBASE_NAME" limit=1000 "select tr.* from schema.table tr where tr.date = sysdate

I am having trouble defining the date as the dbquery needs to be the first item on the search line.

Can anyone help?
Thanks,

Tags (1)
0 Karma
1 Solution

obrienk
Explorer

I got this working by using the date in the database

ie. tr.date = to_date(current_date)

View solution in original post

0 Karma

obrienk
Explorer

I got this working by using the date in the database

ie. tr.date = to_date(current_date)

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...