Splunk Search

Need to create a Dashboard which can select multiple fields based on user selection of checkbox/ radio button.

jithinmathew
Explorer

Hi all,

I Need to create a Dashboard which can select multiple extracted fields based on user selection of checkbox/ radio button.

alt text

For example, I want the user to be able to search with both fields ServiceID AND Username. I currently have the single search functionality working but I cant seem to think of how I will pass multiple fields.

Will greatly appreciate any help with this.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi jithinmathew,
I had a similar problem and I solved it creating a filter for each field.

In addition you have to manage the problem that not all the fields had 100% values so if you use "All" () as default for all fields you exclude all the events that haven't one of the fields.
To manage this problem, you have to use ad default something like: `Username=
OR NOT Username=*`
Bye.
Giuseppe

0 Karma

renjith_nair
Legend

@jithinmathew,

Are you looking for something similar?

<form>
  <label>Radio Button</label>
  <fieldset submitButton="false">
    <input type="radio" token="sourcetype">
      <label>Sourc e Type</label>
      <choice value="splunkd">SPLUNKD</choice>
      <choice value="kvstore">KVSTORE</choice>
      <choice value="audittrail">AUDIT TRIAL</choice>
    </input>
    <input type="text" token="searchbox">
      <label>Search Box</label>
      <default>$sourcetype$</default>
      <initialValue>$sourcetype$</initialValue>
    </input>
    <input type="radio" token="index" searchWhenChanged="true">
      <label>Include Index In Group By?</label>
      <choice value="index">Yes</choice>
      <choice value="">No</choice>
      <prefix>, </prefix>
    </input>
  </fieldset>
  <row>
    <panel>
      <title>Value from Search Filter : $sourcetype$</title>
      <table>
        <search>
          <query>index=_* sourcetype=$sourcetype$|stats count by sourcetype $index$</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
</form>
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

jithinmathew
Explorer

Hmm no, for example, I want the user to be able to search both splunkd and KVSTORE at the same time instead of one each.

0 Karma

renjith_nair
Legend

@jithinmathew,
That's simple, just change the radio button to checkbox

<form>
  <label>Radio Button</label>
  <fieldset submitButton="false">
    <input type="checkbox" token="sourcetype">
      <label>Sourc e Type</label>
      <choice value="splunkd">SPLUNKD</choice>
      <choice value="kvstore">KVSTORE</choice>
      <choice value="audittrail">AUDIT TRIAL</choice>
      <valuePrefix>sourcetype="</valuePrefix>
      <valueSuffix>"</valueSuffix>
      <delimiter> OR </delimiter>
      <prefix>(</prefix>
      <suffix>)</suffix>
    </input>
    <input type="text" token="searchbox">
      <label>Search Box</label>
      <default>$sourcetype$</default>
      <initialValue>$sourcetype$</initialValue>
    </input>
    <input type="radio" token="index" searchWhenChanged="true">
      <label>Include Index In Group By?</label>
      <choice value="index">Yes</choice>
      <choice value="">No</choice>
      <prefix>, </prefix>
    </input>
  </fieldset>
  <row>
    <panel>
      <title>Value from Search Filter : $sourcetype$</title>
      <table>
        <search>
          <query>index=_* $sourcetype$|stats count by sourcetype $index$</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
</form>
---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In November, the Splunk Threat Research Team had one release of new security content via the Enterprise ...

Index This | Divide 100 by half. What do you get?

November 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

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

❄️ Celebrate the season with our December lineup of Community Office Hours, Tech Talks, and Webinars! ...