Dashboards & Visualizations

How can I pass a variable from a visualization to a datasource?

ykoer
New Member

I have multiple pie charts, each showing data from a different cluster.

I would like to define one generic datasource that gets the cluster name as an input.  Is there a possibility to define/set variables within a visualization block and pass it to a datasource? 

 

{
	"visualizations": {
		"viz_pie_chart_cluster1": {
			"type": "viz.pie",
			"dataSources": {
				"primary": "ds1"
			},
			"title": "Cluster 1",
			"options": {
				"chart.showPercent": true,
			}
			# I want to pass the cluster_name=cluster1 from this vizualization
		},
		"viz_pie_chart_cluster2": {
			"type": "viz.pie",
			"dataSources": {
				"primary": "ds1"
			},
			"title": "Cluster 2",
			"options": {
				"chart.showPercent": true,
			}
			# I want to pass the cluster_name=cluster2 from this vizualization
		}
	},
	"dataSources": {
		"ds1": {
			"type": "ds.search",
			"options": {
				"query": "... cluster_name=$cluster_name$ ..."
			},
			"name": "ds1"
		}
	}
}

 

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

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 ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...