Dashboards & Visualizations

Can I have tokens with constant values in Dashboard Studio?

ssslock
New Member

I'm working on building non production dashboard for our app with Dashboard Studio. I want to have some values in my queries set via a token so I can easily modify the value when I copy the dashboard to production.
I have some success with a text input to save the value for me, and trying to set the token value without a input. I have find  this page which talk about I can set default values for tokens, but it seems don't work. Is there anyway to do it?

Working version with input:

{
"visualizations": {
"viz_rMCf491V": {
"type": "viz.column",
"title": "Response Status Code",
"description": "",
"dataSources": {
"primary": "ds_kfldHPlv"
}
}
},
"dataSources": {
"ds_kfldHPlv": {
"type": "ds.search",
"options": {
"query": "index=$index_token$ | timechart count by STATUS"
},
"name": "ds_response_status_code"
}
},
"defaults": {
"dataSources": {
"ds.search": {
"options": {
"queryParameters": {
"latest": "$global_time.latest$",
"earliest": "$global_time.earliest$"
}
}
}
}
},
"inputs": {
"input_global_trp": {
"type": "input.timerange",
"options": {
"token": "global_time",
"defaultValue": "-60m@m,now"
},
"title": "Global Time Range"
},
"input_lpS6S4xZ": {
"options": {
"defaultValue": "some_index_value",
"token": "index_token"
},
"title": "Gateway Index",
"type": "input.text"
}
},
"layout": {
"type": "grid",
"options": {},
"structure": [
{
"item": "viz_rMCf491V",
"type": "block",
"position": {
"x": 0,
"y": 0,
"w": 1200,
"h": 400
}
}
],
"globalInputs": [
"input_global_trp",
"input_lpS6S4xZ"
]
},
"description": "",
"title": "Sample Dashboard"
}


<p><br />Not working version:<li-code lang="markup">{
"visualizations": {
"viz_rMCf491V": {
"type": "viz.column",
"title": "Response Status Code",
"description": "",
"dataSources": {
"primary": "ds_kfldHPlv"
}
}
},
"dataSources": {
"ds_kfldHPlv": {
"type": "ds.search",
"options": {
"query": "index=$index_token$ | timechart count by STATUS"
},
"name": "ds_response_status_code"
}
},
"defaults": {
"dataSources": {
"ds.search": {
"options": {
"queryParameters": {
"latest": "$global_time.latest$",
"earliest": "$global_time.earliest$"
}
}
}
},
"tokens": {
"default": {
"index_token": {
"value": "some_index_value"
}
}
}
},
"inputs": {
"input_global_trp": {
"type": "input.timerange",
"options": {
"token": "global_time",
"defaultValue": "-60m@m,now"
},
"title": "Global Time Range"
}
},
"layout": {
"type": "grid",
"options": {},
"structure": [
{
"item": "viz_rMCf491V",
"type": "block",
"position": {
"x": 0,
"y": 0,
"w": 1200,
"h": 400
}
}
]
},
"description": "",
"title": "Sample Dashboard"
}



Not working version with defaults:

{
"visualizations": {
"viz_rMCf491V": {
"type": "viz.column",
"title": "Response Status Code",
"description": "",
"dataSources": {
"primary": "ds_kfldHPlv"
}
}
},
"dataSources": {
"ds_kfldHPlv": {
"type": "ds.search",
"options": {
"query": "index=$index_token$ | timechart count by STATUS"
},
"name": "ds_response_status_code"
}
},
"defaults": {
"dataSources": {
"ds.search": {
"options": {
"queryParameters": {
"latest": "$global_time.latest$",
"earliest": "$global_time.earliest$"
}
}
}
}
},
"inputs": {
"input_global_trp": {
"type": "input.timerange",
"options": {
"token": "global_time",
"defaultValue": "-60m@m,now"
},
"title": "Global Time Range"
},
"input_lpS6S4xZ": {
"options": {
"defaultValue": "some_index_value",
"token": "index_token"
},
"title": "Gateway Index",
"type": "input.text"
}
},
"layout": {
"type": "grid",
"options": {},
"structure": [
{
"item": "viz_rMCf491V",
"type": "block",
"position": {
"x": 0,
"y": 0,
"w": 1200,
"h": 400
}
}
],
"globalInputs": [
"input_global_trp",
"input_lpS6S4xZ"
]
},
"description": "",
"title": "Sample Dashboard"
}


<p><br />Not working version:<li-code lang="markup">{
"visualizations": {
"viz_rMCf491V": {
"type": "viz.column",
"title": "Response Status Code",
"description": "",
"dataSources": {
"primary": "ds_kfldHPlv"
}
}
},
"dataSources": {
"ds_kfldHPlv": {
"type": "ds.search",
"options": {
"query": "index=$index_token$ | timechart count by STATUS"
},
"name": "ds_response_status_code"
}
},
"defaults": {
"dataSources": {
"ds.search": {
"options": {
"queryParameters": {
"latest": "$global_time.latest$",
"earliest": "$global_time.earliest$"
}
}
}
},
"tokens": {
"default": {
"index_token": {
"value": "some_index_value"
}
}
}
},
"inputs": {
"input_global_trp": {
"type": "input.timerange",
"options": {
"token": "global_time",
"defaultValue": "-60m@m,now"
},
"title": "Global Time Range"
}
},
"layout": {
"type": "grid",
"options": {},
"structure": [
{
"item": "viz_rMCf491V",
"type": "block",
"position": {
"x": 0,
"y": 0,
"w": 1200,
"h": 400
}
}
]
},
"description": "",
"title": "Sample Dashboard"
}

 

 

 

 

Labels (2)
0 Karma
Get Updates on the Splunk Community!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...