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!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...