Splunk Search

Dashboard drop down and input option

sushmitha_mj
Communicator

I have created a dashboard with hourly sum(added) values for all users. In the dashboard I want to give the option of drop down to select the user name or a text box where they can enter the name of the user and the graph has to display the result of this user alone.
How can I create a drop box or text box and pass the value to the query?

0 Karma
1 Solution

Patient
Path Finder

Hi sushmitha,

You can create a Dropdown or text box using this simple xml code to Display the results in a table. The following is the complete dynamic form search:

<form>
  <label>Username</label>
  <searchTemplate>sourcetype=logins $username$</searchTemplate>  
  <fieldset>
    <input type="dropdown" token="username">
       <label>Select Name</label>
       <populatingSearch fieldForValue="user" fieldForLabel="user">
          <![CDATA[sourcetype=YourSourcetype
          | stats count by user]]>
        </populatingSearch>
    </input>
  </fieldset>

  <row>
    <table>
      <title>User</title>
        <option name="showPager">true</option>
      </table>
  </row>
</form>

If You have your customize search wich populate your dashboard, yo can replace the

 <row> ....  </row> with the below code:

<row>
    <panel>
        <event>
                  <searchString>index=your_Index  User=$username$ | ....  </searchString>
            <earliestTime/>
            <latestTime/>
          </event>
      </panel>
  </row>

View solution in original post

ngatchasandra
Builder

Hi sushmitha,
In your dashbaord, edit panel and add dropdown input type. Click on pen who is on input that you added.

To configure it, see the Splunk viz manual where you are going to see, Follow the link
http://docs.splunk.com/Documentation/Splunk/latest/Viz/Aboutthismanual

You will see all diffferents types of input form configuratioons.

This is an example:

 <input type="dropdown" token="user">
    <label>Select User</label>
    <populatingSearch fieldForLabel="user" fieldForValue="user">index=...|stats count by user</populatingSearch>
    <default> Default user to see on input</default>
  </input>

and call the token in your search panel like

<panel>
       <title>User panel</title>
       <table>

         <search>
           <query>index=...  user=$user$|.....</query>
         </search>
         <option name="wrap">true</option>
         <option name="rowNumbers">false</option>
         <option name="dataOverlayMode">none</option>
         <option name="drilldown">cell</option>
         <option name="count">10</option>
       </table>

sushmitha_mj
Communicator

It worked...
Thanks...

0 Karma

Patient
Path Finder

Hi sushmitha,

You can create a Dropdown or text box using this simple xml code to Display the results in a table. The following is the complete dynamic form search:

<form>
  <label>Username</label>
  <searchTemplate>sourcetype=logins $username$</searchTemplate>  
  <fieldset>
    <input type="dropdown" token="username">
       <label>Select Name</label>
       <populatingSearch fieldForValue="user" fieldForLabel="user">
          <![CDATA[sourcetype=YourSourcetype
          | stats count by user]]>
        </populatingSearch>
    </input>
  </fieldset>

  <row>
    <table>
      <title>User</title>
        <option name="showPager">true</option>
      </table>
  </row>
</form>

If You have your customize search wich populate your dashboard, yo can replace the

 <row> ....  </row> with the below code:

<row>
    <panel>
        <event>
                  <searchString>index=your_Index  User=$username$ | ....  </searchString>
            <earliestTime/>
            <latestTime/>
          </event>
      </panel>
  </row>

sushmitha_mj
Communicator

It worked...
Thanks...

0 Karma

Patient
Path Finder

Thank you for your vote!

0 Karma
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!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...