Dashboards & Visualizations

Dropdown or time range picker in dashboard

snigdhasaxena
Communicator

if we do configuration in UI to add a time range picker or dropdown in dashboard, do we still need to make any chnages in xml ?

Tags (1)
0 Karma
1 Solution

harshpatel
Contributor

Hi @snigdhasaxena,

You have to set timerange to be the token in the panel's options.

  1. Click on the edit search button at top right of the panel alt text
  2. Under timerange select your shared token timerange alt text

View solution in original post

0 Karma

harshpatel
Contributor

Hi @snigdhasaxena,

You have to set timerange to be the token in the panel's options.

  1. Click on the edit search button at top right of the panel alt text
  2. Under timerange select your shared token timerange alt text
0 Karma

snigdhasaxena
Communicator

Thank you, it helped.
But I'm adding a dropdown to select category alongwith time range picker, it doesn't work together. Any suggestions ?

0 Karma

samupadh
New Member

@snigdhasaxena

It can work. the above example will work for time range picker only.
For dropdown, like if we have drop down for category, then in the search string, you need to pass that value like

index=abc category=$category_tok$

where category_tok is the token name of dropdown.

0 Karma

snigdhasaxena
Communicator

I have only one panel in my dashboard and have configured time range picker from UI but it doesn't work

alt text

0 Karma

samupadh
New Member

Hello @snigdhasaxena,

you can do it from UI only. One you have created the drop down or time range picker.

then on the panel click on edit search, and select the Time range as shared time picker. see below

0 Karma

samupadh
New Member
<form>
  <label>test1</label>
  <fieldset submitButton="false">
    <input type="time" token="time_tok" searchWhenChanged="true">
      <label>Select Time</label>
      <default>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </default>
    </input>
  </fieldset>
  <row>
    <panel>
      <title>$time1$</title>
      <single>
        <search>
          <done>
            <set token="time1">$result.time_in_sec$</set>
          </done>
          <query>| makeresults | eval latest1=if($time_tok.latest|s$ == "now", now(),$time_tok.latest|s$)  | eval earliest1 = if($time_tok.latest|s$ == "now", relative_time(now(), $time_tok.earliest|s$), $time_tok.earliest|s$)  | eval time_in_sec= latest1 - earliest1 | eval time_in_sec = time_in_sec -  (time_in_sec % 60) | fields + time_in_sec</query>
          <earliest>$time_tok.earliest$</earliest>
          <latest>$time_tok.latest$</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </single>
    </panel>
  </row>
</form>
0 Karma

DMohn
Motivator

You can make all neccessary configuration changes in the UI, without the need to touch the plain XML code.

If you integrate a timetange picker in your Dashboard, use the edit search function for all panels in your dashboard to use the shared time picker as time constraint.

For a dropdown selection you can specify a token name in the UI as well, which you can then integrate in the searches powering your panels - such as

<your search> sourcetype=$yourTokenHere$ | rest_of_your_search
0 Karma

Nadhiyaa
Path Finder

No, not required. It depends on the customization of how you want to the dropdown and time range picker to be .

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...