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!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...