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!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...