Dashboards & Visualizations

Default Date XML

Path Finder


I am trying to create a dashboard which I can show different dashboards in one by changing the date range and other parameters. Everything is working fine, but there is one problem am trying to solve. The problem is I want to have a default date of Today's date (for the End Date) and 30 days before today's date (for starting Date). My dashboard is calling a stored procedure in the database and it has three parameters to run successfully. Here is part of my XML:



So, how can I set up the EndDate to be Today's date and the StartDate to be 30 days before today's date??

Any help or suggestion is appreciated


0 Karma

Revered Legend

I am not aware of any option to assign dynamic value to input of type text. One workaround could be to convert these text input to dropdown input and run a query to get the values. That way it would be dynamic and you can control the format. An example would be like this. [In Splunk 5.x, the value should be selected by default in the dropdown. In Splunk 6.0, it will not select any value and user would have to select a value. In Splunk 6.0.1 onwards, you would have to add <selectFirstChoice>true</selectFirstChoice> to the dropdown inputs to select the value by default.

  <input type="dropdown" token="startdate">
    <populatingSearch fieldForValue="startdate" fieldForLabel="startdate">
      <![CDATA[|stats count | eval startdate=strftime(now(),"%m/%d/%Y") | table startdate ]]>
    <input type="dropdown" token="enddate">
    <populatingSearch fieldForValue="enddate" fieldForLabel="enddate">
      <![CDATA[|stats count | eval enddate=strftime(relative_time(now(),"-30d"),"%m/%d/%Y") | table enddate ]]>
      <searchString>index=_internal | stats count by sourcetype</searchString>
0 Karma

New Member

What if I want 5 days before today and today in my dropdown?
could you please help me?

0 Karma

Path Finder

The time range picker does not work because of the time format differences between the database and Splunk. so, the answer you posted won't work in my case

0 Karma
Register for .conf21 Now! Go Vegas or Go Virtual!

How will you .conf21? You decide! Go in-person in Las Vegas, 10/18-10/21, or go online with .conf21 Virtual, 10/19-10/20.