Dashboards & Visualizations

radio button/Dropdown t choose between two types of hosts group

sarnagar
Contributor

I have a dashboard for showing the status of hosts.

I want the dashboard to populate when I choose the hosts via drop down/ radiobutton.

The two hosts groups are something like this.

  1. host=ab* OR host=cd*
  2. host=xy* OR host=un*

My dashboard panels have a search like below:

index = abc hosts=ab* OR host =bc* source =svd.log....

Although I can create a dropdown for these host types I dont think i can replace the highlighted value in the query...

Can someone suggest me how to achieve this>?

Tags (2)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

Hi
Can you please try below XML?

<form>
  <label>Multiple Value Dropdown</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="Sourcetype">
      <label>Source Type</label>
      <choice value="scheduler,splunkd">A</choice>
      <choice value="splunk_web_service,splunk_web_access">B</choice>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <title>$Sourcetype$</title>
        <search>
          <query>index=_internal [| makeresults | eval sourcetype="$Sourcetype$" | makemv delim="," sourcetype | mvexpand sourcetype  | format] | stats count by sourcetype</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>
</form>

Happy Splunking

View solution in original post

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Hi
Can you please try below XML?

<form>
  <label>Multiple Value Dropdown</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="Sourcetype">
      <label>Source Type</label>
      <choice value="scheduler,splunkd">A</choice>
      <choice value="splunk_web_service,splunk_web_access">B</choice>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <title>$Sourcetype$</title>
        <search>
          <query>index=_internal [| makeresults | eval sourcetype="$Sourcetype$" | makemv delim="," sourcetype | mvexpand sourcetype  | format] | stats count by sourcetype</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>
</form>

Happy Splunking

0 Karma

sarnagar
Contributor

Thnakyou @ kamlesh_vaghela , that helped.

0 Karma
Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

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 ...