Splunk Search

add token value of dropdown menu to search

schufi01
Path Finder

Hi,

I would like to filter a dashboard by using a Dropdown Input at the top of my dashboard. By selecting one of the dropdown values (Total, Data A, Data B) the charts and tables should only show values of the chosen dataset. Data A and Data B can be distinguished by field12, that consists of numbers. For Data A field12 always starts with 1 or 2. For  Data B field12 always starts with a 7. For Total it doesnt matter, because total should contain all data.

Can somebody tell me what I need to add to the Search of my tables and charts and what I need to do with the tokens?

Labels (2)
0 Karma
1 Solution

manjunathmeti
Champion

hi @schufi01,
You can create a dropdown with values with field12 filters- 1* OR 2* (for Data A), 7* (for Data B) and * (Total).

 

<fieldset submitButton="true" autoRun="false"> 
  <input type="dropdown" token="myfield">
      <label>Select Data</label>
      <choice value="field12=&quot;1*&quot; OR field12=&quot;2*&quot;">Data A</choice>
      <choice value="field12=&quot;7*&quot;">Data B</choice>
      <choice value="field12=&quot;*&quot;">Total</choice>
  </input>
</fieldset>

 

Use token in your table search query like below:

 

index=index $myfield$

 

If this reply helps you, an upvote/like would be appreciated.

View solution in original post

manjunathmeti
Champion

hi @schufi01,
You can create a dropdown with values with field12 filters- 1* OR 2* (for Data A), 7* (for Data B) and * (Total).

 

<fieldset submitButton="true" autoRun="false"> 
  <input type="dropdown" token="myfield">
      <label>Select Data</label>
      <choice value="field12=&quot;1*&quot; OR field12=&quot;2*&quot;">Data A</choice>
      <choice value="field12=&quot;7*&quot;">Data B</choice>
      <choice value="field12=&quot;*&quot;">Total</choice>
  </input>
</fieldset>

 

Use token in your table search query like below:

 

index=index $myfield$

 

If this reply helps you, an upvote/like would be appreciated.

schufi01
Path Finder

Thank you, helped me a lot

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

The value in your dropdown can be stored in a token which can be used in the searches for your dashboards. Depending on what your searches look like, will need to set the values of the token appropriately. You refer to the token by surrounding the token name with $ e.g. $token1$

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...