Dashboards & Visualizations

Radio button and dropdown with populatedSearch

ddarmand
Communicator

Hello everyone,

I wants to create a dropdown that will list all of my hosts based on a source selected by a radio button.

How can i do that ?

Here is my code, actually not working :




<searchTemplate>index=main  host=$hote$ source=$rzosrc$</searchTemplate>

<fieldset autorun="on">
    <input type="radio" token="rzosrc">
        <label>Choix du reseau</label>
        <choice value="RMS">RMS</choice>
        <choice value="RTH">RTH</choice>
        <choice value="SPP">SPP</choice>
    </input>

    <input type="dropdown" token="hote">
        <label>Choix host</label>  
        <populatingSearch fieldForValue="host" fieldForLabel="host" earliest="-2d" latest="now">| metadata source=$rzosrc$ type="hosts" index="main"
        </populatingSearch>
     </input>

</fieldset>

<row>
    <event>
        <title>Results</title>
        <option name="count">50</option>
    </event>
</row>


Thanks you

Tags (1)
1 Solution

stefano_guidoba
Communicator

Hi,

My Code

here is my Advanced XML to create a Dropdown list populated with a search. My suggestion is to put another pulldown around it to let you select your source and use that parameter in the subsequent search that will finally populate the second dropdown.

Regards,
Stefano

View solution in original post

nfilippi_splunk
Splunk Employee
Splunk Employee

In Splunk 6, this is now possible using Simple XML as part of the re-design to enable the use of tokens anywhere in the page.

There is an example of this "Cascading Form Input" within the "Splunk 6 Dashboard Examples" App (http://apps.splunk.com/app/1603/).

Here is the example XML:

<form>
  <label>Cascading Form Input Element</label>
  <description>A form input element's selected value is used to populate another form input element's options.</description>
  <fieldset autoRun="true">
    <input type="dropdown" token="username">
      <default>*</default>
      <choice value="*">All</choice>
      <populatingSearch fieldForValue="user" fieldForLabel="user" earliest="-24h" latest="now">
        <![CDATA[index=_internal | stats count by user]]>
      </populatingSearch>
    </input>
    <input type="radio" token="source">
      <default>*</default>
      <choice value="*">All</choice>
      <populatingSearch fieldForValue="sourcetype" fieldForLabel="sourcetype" earliest="-24h" latest="now">
        <![CDATA[index=_internal user=$username$| stats count by sourcetype]]>
      </populatingSearch>
    </input>
  </fieldset>
  <row>
    <table>
      <title>Table of events</title>
      <searchString>index=_internal user=$username$ sourcetype=$source$ | head 1000 | table _time, user, sourcetype, _raw</searchString>
      <earliestTime>-24h@h</earliestTime>
      <latestTime>now</latestTime>
    </table>
  </row>
</form>

stefano_guidoba
Communicator

Hi,

My Code

here is my Advanced XML to create a Dropdown list populated with a search. My suggestion is to put another pulldown around it to let you select your source and use that parameter in the subsequent search that will finally populate the second dropdown.

Regards,
Stefano

stefano_guidoba
Communicator

have you installed sideview utils app?

0 Karma

ddarmand
Communicator

Thanks but when i try to test this code, i code the error message "layoutPanel is not define for module pulldown" and for module search ect... what should i do ?

0 Karma

ddarmand
Communicator

Nobody ? please !

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...