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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...