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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...