Getting Data In

Splunk DB Connect 1: Why am I unable to apply the date range from the time range picker to filter my query?

kavyaa
Explorer

Hi,

I have connected to Splunk database. I have applied "dropdown input" filter on "Transdate column". When I click on "2011-03-22", it is showing "2011-03-22" data. Filter is working fine. Token name as "field1" & query is as below.

| dbquery "srdb" "SELECT   TransDate as '_time', ShowRoomCode as srcode , Num_of_Customers as totalcs FROM  Centro_Customer_Visit where Centro_Customer_Visit.TransDate
='$field1$'"

But I want to apply time range picker on "TransDate" column dynamically. I have tried, but I didn't get the date range.

I have data from 2011 to 2015. I want to fetch data from March 2011 to April 2011 using time range picker. Is it possible? How it will work? Please help me and send any documentation on this.......

Thanks in advance,
A.kavya.

0 Karma

acharlieh
Influencer

Actually this exact problem seems to have been posted with a couple of solutions in a previous answer: https://answers.splunk.com/answers/75999/splunk-db-connect-dbquery-inline-search-and-time-filtering-...

kavyaa
Explorer

I have seen that post. I have tried . But i did nt get correct data regarding selected input time filter. The code is follows. Please help me. Timestamp column "TransDate" has no time , only date values

Trandate coulmn have data format like this

2011-03-18
2011-06-26
2012-03-16
2012-05-21
2013-04-23
2013-07-14
2014-02-12
2014-03-29
2015-01-21

xml code is as follow

**<form>
  <label>sample_time</label>
  <fieldset submitButton="false" autoRun="true">
    <input type="time" token="TOKEN1" searchWhenChanged="true">
      <label>Selct Date</label>
      <default>
        <earliest>1300645800</earliest>
        <latest>1300905000</latest>
      </default>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>| dbquery "CENTRO" "SELECT   TransDate , ShowRoomCode as srcode , Num_of_Customers as totalcs FROM  Centro_Customer_Visit  WHERE TransDate='$TOKEN1$'"</query>
          <earliest>1300645800</earliest>
          <latest>1332527400</latest>
        </search>
        <option name="wrap">true</option>
        <option name="rowNumbers">false</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">cell</option>
        <option name="count">10</option>
      </table>
    </panel>
  </row>
</form>**
0 Karma
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...