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
SplunkTrust
SplunkTrust

@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>
Happy Splunking!
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
SplunkTrust
SplunkTrust

@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>
Happy Splunking!
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...