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 !

Get Updates on the Splunk Community!

Now Available: Cisco Talos Threat Intelligence Integrations for Splunk Security Cloud ...

At .conf24, we shared that we were in the process of integrating Cisco Talos threat intelligence into Splunk ...

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Easily Improve Agent Saturation with the Splunk Add-on for OpenTelemetry Collector

Agent Saturation What and Whys In application performance monitoring, saturation is defined as the total load ...