Dashboards & Visualizations

Simple XML - How to set a default value for a token when not passed in via URL

simpkins1958
Contributor

I have a dashboard that I want to also use as a drill down target. URL for the drilldown is:

/devices?sourcetype_tok=*&device_tok=*&earliest=-2d&latest=now&form.device_tok=*

Url from list of dashboards list is:

/devices?earliest=-2d&latest=now&form.device_tok=*

sourcetype_tok token is not part of the url and charts are displaying: Search is waiting for input...

From within devices.xml I want to set the sourcetype_tok token to "*" only when it is not part of the calling url. How do I do this? Thanks.

Tags (2)
0 Karma

hardikJsheth
Motivator

You can do this via java script. Adding script to be called in form tag as follows:

<form script="t_activity.js">

Then in the JS

equire(['jquery', 'underscore', 'splunkjs/mvc', 'splunkjs/mvc/tokenutils', 'autopause_util', 'splunkjs/mvc/simplexml/ready!'],
function ($, _, mvc, tokenutils) {

submittedTokens.set('sourcetype_tok', "*")

}

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...