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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...