Dashboards & Visualizations

using multiple tokens to populate a dashboard

jcgever
Explorer

I'm new to xml and building dashboards in splunk. What I'm trying to do is build a dashboard that takes information from the user through drop down menus that build on each other. I've gotten it almost figured out but the last drop down menu doesn't populate with any results. Any pointers? here is what I have so far:

<form>
  <label>Environment search</label>
  <fieldset submitButton="false">
    <input type="time" token="datetime" searchWhenChanged="true">
      <label>Date and Time</label>
      <default>
        <earliest>-15m</earliest>
        <latest>now</latest>
      </default>
    </input>
    <input type="dropdown" token="env" searchWhenChanged="true">
      <label>Environment</label>
      <choice value="*">all</choice>
      <choice value="*l1q*">qa</choice>
      <choice value="*l1d*">dev</choice>
      <choice value="*l1s*">stg</choice>
      <choice value="*1p*">prod</choice>
      <fieldForLabel>env</fieldForLabel>
      <fieldForValue>env</fieldForValue>
      <search>
        <query/>
        <earliest>$datetime.earliest$</earliest>
        <latest>$datetime.latest$</latest>
      </search>
    </input>
    <input type="dropdown" token="host">
      <label>Host</label>
      <fieldForLabel>host</fieldForLabel>
      <fieldForValue>host</fieldForValue>
      <search>
        <query>host=*$env$ | dedup host</query>
        <earliest>$datetime.earliest$</earliest>
        <latest>$datetime.latest$</latest>
      </search>
      <choice value="*">all</choice>
      <default>*</default>
      <initialValue>*</initialValue>
    </input>
    <input type="dropdown" token="apps" searchWhenChanged="true">
      <label>Apps</label>
      <fieldForLabel>apps</fieldForLabel>
      <fieldForValue>apps</fieldForValue>
      <search>
        <query>host=$host$ index=* |dedup index host</query>
        <earliest>$datetime.earliest$</earliest>
        <latest>$datetime.latest$</latest>
      </search>
      <choice value="*">all</choice>
      <default>*</default>
      <initialValue>*</initialValue>
    </input>
  </fieldset>
  <row>
    <panel>
      <event>
        <title>logs</title>
        <search>
          <query>host=$host$ index=$apps$</query>
          <earliest>$datetime.earliest$</earliest>
          <latest>$datetime.latest$</latest>
        </search>
        <option name="list.drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </event>
    </panel>
  </row>
</form>
0 Karma

jcgever
Explorer

Thanks! I didn't think to use tstats. Works like a charm now.

0 Karma

somesoni2
Revered Legend

Give this a try

<form>
   <label>Environment search</label>
   <fieldset submitButton="false">
     <input type="time" token="datetime" searchWhenChanged="true">
       <label>Date and Time</label>
       <default>
         <earliest>-15m</earliest>
         <latest>now</latest>
       </default>
     </input>
     <input type="dropdown" token="env" searchWhenChanged="true">
       <label>Environment</label>
       <choice value="*">all</choice>
       <choice value="*l1q*">qa</choice>
       <choice value="*l1d*">dev</choice>
       <choice value="*l1s*">stg</choice>
       <choice value="*1p*">prod</choice>
     </input>
     <input type="dropdown" token="host" searchWhenChanged="true">
       <label>Host</label>
       <fieldForLabel>host</fieldForLabel>
       <fieldForValue>host</fieldForValue>
       <search>
         <query>| tstats count WHERE host=*$env$ by host | table host</query>
         <earliest>$datetime.earliest$</earliest>
         <latest>$datetime.latest$</latest>
       </search>
       <choice value="*">all</choice>
       <default>*</default>
       <initialValue>*</initialValue>
     </input>
     <input type="dropdown" token="apps" searchWhenChanged="true">
       <label>Apps</label>
       <fieldForLabel>index</fieldForLabel>
       <fieldForValue>index</fieldForValue>
       <search>
         <query>| tstats count WHERE host=$host$ by index | table index </query>
         <earliest>$datetime.earliest$</earliest>
         <latest>$datetime.latest$</latest>
       </search>
       <choice value="*">all</choice>
       <default>*</default>
       <initialValue>*</initialValue>
     </input>
   </fieldset>
   <row>
     <panel>
       <event>
         <title>logs</title>
         <search>
           <query>host=$host$ index=$apps$</query>
           <earliest>$datetime.earliest$</earliest>
           <latest>$datetime.latest$</latest>
         </search>
         <option name="list.drilldown">none</option>
         <option name="refresh.display">progressbar</option>
       </event>
     </panel>
   </row>
 </form>
Get Updates on the Splunk Community!

Get ready to show some Splunk Certification swagger at .conf24!

Dive into the deep end of data by earning a Splunk Certification at .conf24. We're enticing you again this ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Now On-Demand Join us to learn more about how you can leverage Service Level Objectives (SLOs) and the new ...

Database Performance Sidebar Panel Now on APM Database Query Performance & Service ...

We’ve streamlined the troubleshooting experience for database-related service issues by adding a database ...