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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...