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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...