下拉列表中的索引分组

问题描述 投票:0回答:1

我有20个索引,我们希望以分组方式在下拉列表中显示它们。如何在查询中将它们分组?例如:-

index1,Index2,index3应该带有名称abc...。索引4,索引2,索引5应该带有名称efg ...

因此在下拉列表中,我们应该只看到值为abc,efg的值。因此一旦选择了abc,则下面的面板应显示相应的图形。]

splunk splunk-query splunk-calculation splunk-formula splunk-sum
1个回答
0
投票

在表单/仪表板的开头放置以下内容将为您提供一个下拉列表,您可以从其中选择与相应的索引集相对应的选项abcdef

<form>
  <label>Index Group Test</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="indexes">
      <label>Index Group</label>
      <choice value="index=index1 OR index=index2 OR index=index3">abc</choice>
      <choice value="index=index4 OR index=index5 OR index=index6">def</choice>
      <selectFirstChoice>true</selectFirstChoice>
    </input>
  </fieldset>
</form>

然后您将在查询中使用标记$indexes$来获取选定的索引数据。例如,

<form>
  <label>Index Group Test</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="indexes">
      <label>Index Group</label>
      <choice value="index=index1 OR index=index2 OR index=index3">abc</choice>
      <choice value="index=index4 OR index=index5 OR index=index6">def</choice>
      <selectFirstChoice>true</selectFirstChoice>
    </input>
  </fieldset>
  <row>
    <panel>
      <event>
        <title>Event Data</title>
        <search>
          <query>$indexes$</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="list.drilldown">none</option>
      </event>
    </panel>
  </row>
</form>
© www.soinside.com 2019 - 2024. All rights reserved.