Search code examples
splunksplunk-query

how to access labels and values of form multi select inputs in splunk


i have a multi select input and able to get the values but want to get all the label values.

<fieldset submitButton="false" autoRun="true">
<input type="multiselect" token="endpoint" searchWhenChanged="true">
  <label>Endpoints</label>
  <choice value="/project/api-aaa/v1.0">api-aaa</choice>
  <choice value="/project/api-bbb/v1.0">api-bbb</choice>
  <choice value="/project/api-ccc/v1.0">api-ccc</choice>
  <delimiter> OR </delimiter>
  <valuePrefix>"</valuePrefix>
  <valueSuffix>"</valueSuffix>
  <default>/project/api-aaa/v1.0,/project/api-bbb/v1.0,/project/api-ccc/v1.0</default>
  <change>
  <set token="dropToken_label">$label$</set> // this is working partially and able to get first label which is `api-aaa`
  </change>
</input>

<set token="dropToken_label">$label$</set> // this is working partially and able to get first label which is api-aaa

i need to access all the labels selected ?


Solution

  • To access all the labels you need to use a delimiter: delimiter=","

    <change>
    <set token="dropToken_label" delimiter=",">$label$</set>
    </change>