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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...