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!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...