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

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!

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

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...