Getting Data In

How to filter data by multiselect

quintessence
New Member

I'm trying to use multiselect for filtering my charts data:

search "msg.mdc.headers.consumer{}"=$consumer$

, where $consumer$ is my multiselect token.
But when I have multiple values selected (val1, val2) - the search doesn't work.

0 Karma

vnravikumar
Champion

Hi

Check this sample and try with valuePrefix , valueSuffix and delimiter

<form>
  <label>multiselect</label>
  <fieldset submitButton="false">
    <input type="multiselect" token="sourcetype">
      <label>Source Type</label>
      <valuePrefix>(sourcetype=</valuePrefix>
      <valueSuffix>)</valueSuffix>
      <delimiter> OR </delimiter>
      <fieldForLabel>sourcetype</fieldForLabel>
      <fieldForValue>sourcetype</fieldForValue>
      <search>
        <query>index=_internal |stats count by sourcetype</query>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </search>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <search>
          <query>index=_internal $sourcetype$</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
</form>
0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...