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!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...