Splunk Search

Run search according to user inputs(If/Else conditions)

john
Communicator

Hi,

I want to run search queries depend on user input,ie what user selecting from dropdown.

eg:if user choose 1 from dropdown
run a search
2 from dropdown run another search
is this possible

iam looking sumthing like this
if(1)
run 1st search

if(2)

run 2nd search

please help.

Tags (1)

woodcock
Esteemed Legend

Like this:

<form>
  <label>Two search example</label>
  <description>A question in answers.splunk.com</description>
  <fieldset autoRun="true" submitButton="false">
    <input type="dropdown" token="search_string_tok1">
      <label>Hard-Coded Searches</label>
      <choice value="earliest=0 latest=now() | head 5">last 5 events</choice>
      <choice value="earliest=0 latest=now() | head 10">last 10 events</choice>
      <default>last 5 events</default>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <title>User-selected search</title>
        <searchString>$search_string_tok1$</searchString>
        <option name="list.drilldown">full</option>
        <option name="list.wrap">1</option>
        <option name="maxLines">5</option>
        <option name="raw.drilldown">full</option>
        <option name="rowNumbers">false</option>
        <option name="table.drilldown">all</option>
        <option name="table.wrap">1</option>
        <option name="type">list</option>
        <option name="wrap">true</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">cell</option>
        <option name="count">10</option>
      </table>
    </panel>
  </row>
</form>
0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

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

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 GA in US-AWS!

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