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!

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...