Dashboards & Visualizations

Is it possible to turn a dashboard input either on or off?

dbagdanoff
Explorer

I have an inventory dashboard. I'd like to have a checkbox to "show these items only".
My thinking is, when checked, the search will be applied. when unchecked, the search will be ignored. hope that makes sense.

0 Karma

alonsocaio
Contributor

Hey, I don't know if this is exactly what you wanted, but I hope It helps you.

I have created a dashboard containing two checkboxes, one returns all of my deployments, and the other one returns just AWS hosts (The "All" check box is the default one).

alt text

If I select the "AWS" check box I will have as results just my AWS hosts:

alt text

Below is my dashboard source code:

<form>
  <label>Assets</label>
  <fieldset submitButton="false">
    <input type="checkbox" token="deployment" searchWhenChanged="true">
      <label>Deployment</label>
      <choice value="*">All</choice>
      <choice value="aws">AWS</choice>
      <search>
        <query/>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </search>
      <delimiter> </delimiter>
      <default>*</default>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <title>Assets</title>
        <search>
          <query>index=answers source=assets.csv deployment=$deployment$
| table hostname, os, deployment</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
  </row>
</form>
0 Karma

dbagdanoff
Explorer

i need to run a search for my "aws" choice. i have no common value to use. hope that makes sense. thanks for the reply!

0 Karma

alonsocaio
Contributor

You mean you need to dynamically populate the check box options?

0 Karma

alonsocaio
Contributor

If that case, you can populate your check box options like this:

<fieldset submitButton="false">
    <input type="checkbox" token="deployment" searchWhenChanged="true">
      <label>Deployment</label>
      <choice value="*">All</choice>
      <search>
        <query>index=answers source=assets.csv
| dedup deployment
| table deployment</query>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </search>
      <delimiter> </delimiter>
      <default>*</default>
      <fieldForLabel>deployment</fieldForLabel>
      <fieldForValue>deployment</fieldForValue>
    </input>
  </fieldset>
0 Karma

dbagdanoff
Explorer

this is what I'm doing now. its giving me a list checkboxes with the values my search returns. while it works, it does not look good lol.

0 Karma
Get Updates on the Splunk Community!

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud  In today’s fast-paced digital ...

Observability protocols to know about

Observability protocols define the specifications or formats for collecting, encoding, transporting, and ...

Take Your Breath Away with Splunk Risk-Based Alerting (RBA)

WATCH NOW!The Splunk Guide to Risk-Based Alerting is here to empower your SOC like never before. Join Haylee ...