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 !

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...

Skip the Awkward Silence: Have a .conf-ersation at .conf26

Picture this. You arrive at .conf26 already having your socializing and networking plans mapped out. No ...

Rethinking Zero Trust: From Product Purchases to Logical Control Evidence

Implementing Zero Trust (ZT) across complex environments often falters at the very beginning due to a ...