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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...