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!

Observability Unlocked: Kubernetes Monitoring with Splunk Observability Cloud

  Ready to master Kubernetes and cloud monitoring like the pros?Join Splunk’s Growth Engineering team for an ...

Wrapping Up Cybersecurity Awareness Month

October might be wrapping up, but for Splunk Education, cybersecurity awareness never goes out of season. ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

&#x1f5e3; You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...