Dashboards & Visualizations

Why is Classic Time picker not cloned in dashboard studio?

marksheinbaum
Explorer

I'm experimenting with converting a classic dashboard to dashboard studio. The classic dashboard has a time picker used to establish a date range for searches in the panels. When I cloned the dashboard to dashboard studio, the time picker is no longer used. All the searches, are searching from the earliest date stored in Splunk which is several years worth of data. Can someone explain what is happening and how to fix. This should be a relatively simple thing to do.

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

So your earliest and latest are set to "all time" - change them to 

		"latest": "$global_time.latest$",
		"earliest": "$global_time.earliest$"

View solution in original post

0 Karma

marksheinbaum
Explorer

I accepted the solution. However, I'm surprised that the cloning process does not generate that automatically.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

If you look at the source of the Studio Dashboard, you should be able to see which timepicker is being used. It is possibly global. Try changing this to your named timepicker.

	"defaults": {
		"dataSources": {
			"ds.search": {
				"options": {
					"queryParameters": {
						"latest": "$global_time.latest$",
						"earliest": "$global_time.earliest$"
					}
				}
			}
		}
	},
0 Karma

marksheinbaum
Explorer

Here's the code from the converted and unmodified dashboard. It's not clear to me exactly what to change per your advise. Can you please clarify? Thanks.

"inputs": {
"input_1": {
"type": "input.timerange",
"title": "Select a time:",
"options": {
"token": "global_time",
"defaultValue": "-60m@m,now"
}
},
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

That looks OK for a timepicker. What about how the datasources are defined? And the defaults?

0 Karma

marksheinbaum
Explorer

Here's how the visualization and corresponding data source are defined. I don't see a "default" in the code. 

"visualizations": {

        "viz_chart_1": {

            "type": "splunk.line",

            "dataSources": {

                "primary": "ds_search_1"

            },

            "showProgressBar": true,

            "title": "nodesim instances ram usage (ps)",

            "options": {

                "yAxisAbbreviation": "auto",

                "y2AxisAbbreviation": "off",

                "showRoundedY2AxisLabels": false,

                "legendTruncation": "ellipsisEnd",

                "showY2MajorGridLines": true,

                "yAxisMajorTickInterval": 1,

                "yAxisTitleText": "Megabytes",

                "nullValueDisplay": "connect",

                "dataValuesDisplay": "off",

                "legendDisplay": "bottom"

            },

            "context": {}

        },

 

"dataSources": {

        "ds_search_1": {

            "type": "ds.search",

            "options": {

                "query": "index=os (sourcetype=ps OR sourcetype=vmstat) (host=scale-sysperf-95x-install-18* ) (COMMAND=CURRENT* OR COMMAND=nodesim)\n| rename memTotalMB as physicalMB\n| appendpipe [ where sourcetype==\"vmstat\" | rename memUsedMB as physicalMB | eval App=\"Physical-Used\"   | fields  physicalMB]\n| stats count sum(RSZ_KB) as RSZ_KB_sum  max(physicalMB) as physicalMB  by _time host COMMAND\n| timechart span=1m avg(eval(if(isnull(physicalMB),RSZ_KB_sum/1000,physicalMB))) as AppRSZ_MB by host",

                "queryParameters": {

                    "earliest": 0,

                    "latest": ""

                }

            }

        },

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

So your earliest and latest are set to "all time" - change them to 

		"latest": "$global_time.latest$",
		"earliest": "$global_time.earliest$"
0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...