Dashboards & Visualizations

How to change search string based on the drop down

jangid
Builder

I want to change the search string based on my dropdown, How do I?

e.g.
Dropdown contains following Items-> TELNET, SESSION, USER, GLOBAL

if type=TELNET
sourcetype=src_telnet | stats ... | table * | rename ..... | where ....

else if type=SESSION
sourcetype=src_session | stats ... | table * | rename ..... | where ....

so on...

I cant do replacestring because my search is completely different from each other.
How can I do this in advanced XML?

Thanks

0 Karma
1 Solution

RicoSuave
Builder

This is actually pretty easy. Save yourself the headache and do this using the pulldown module available from sideview utils. Here is snippet of what it will look like.

    <module name="Pulldown" layoutPanel="panel_row2_col1" autoRun="True">
    <param name="staticFieldsToDisplay">
      <list>
        <param name="value">your first search</param>
        <param name="label">Telnet</param>
      </list>
      <list>
        <param name="value">your second search</param>
        <param name="label">session</param>
      </list>
    </param>
    <param name="name">selectedReport</param>
    <param name="label">Show</param>
    <module name="Search">
      <param name="search">$selectedReport$</param>
      <param name="earliest">-1h</param>
      <param name="latest">now</param>
      <module name="Pager">
        <param name="entityName">results</param>
        <module name="SimpleResultsTable">
          <param name="entityName">results</param>
          <param name="displayRowNumbers">False</param>
        </module>
      </module>
    </module>
  </module>

View solution in original post

RicoSuave
Builder

This is actually pretty easy. Save yourself the headache and do this using the pulldown module available from sideview utils. Here is snippet of what it will look like.

    <module name="Pulldown" layoutPanel="panel_row2_col1" autoRun="True">
    <param name="staticFieldsToDisplay">
      <list>
        <param name="value">your first search</param>
        <param name="label">Telnet</param>
      </list>
      <list>
        <param name="value">your second search</param>
        <param name="label">session</param>
      </list>
    </param>
    <param name="name">selectedReport</param>
    <param name="label">Show</param>
    <module name="Search">
      <param name="search">$selectedReport$</param>
      <param name="earliest">-1h</param>
      <param name="latest">now</param>
      <module name="Pager">
        <param name="entityName">results</param>
        <module name="SimpleResultsTable">
          <param name="entityName">results</param>
          <param name="displayRowNumbers">False</param>
        </module>
      </module>
    </module>
  </module>
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...