Set global and local defaults
Using defaults can save you time by only having to set a data source or visualization option in one place. All options available for data sources can be declared in this section. If you declare an option in the defaults section for ds.search, for example, and have not set a refresh in the stanza, the default will apply to all such stanzas, including base searches and their respective chain searches.
There are three ways to that you can set set the properties for your dashboard:
- You can set them in the
defaultssection of the dashboard definition at thegloballevel for all visualizations or all data sources and add individual exceptions.
- You can set them in the
defaultssection without using theglobaldesignation, but instead, by data source type or visualization type.
- You can set them at the visualization or data source component level, within the stanza, without using the
defaultssection. Local settings will always override any of the same settings set indefaults.
For a list of default configuration options, see Default configuration options. For setting token defaults, see Setting tokens on a visualization click.
Use global defaults
For example, the following code snippet from the defaults section uses the global field to set refresh and refreshType settings for all data sources. However, because the data source type ds.search is also listed with a different time setting for refresh, all data source stanzas of that type will override the global refresh rate setting and respect the 5 minute refresh rate. Since no refreshType option is set, the ds.search stanzas, along with all other data source types, will inherit the refreshType setting.
"defaults": {
"dataSources": {
"global": {
"options": {
"refresh": "1m",
"refreshType": "delay"
}
}
"ds.search": {
"options": {
"refresh": "5m"
}
},
"visualizations": {
"global": {
"showProgressBar": false,
"showLastUpdated": false
},
"splunk.bar": {
"showProgressBar": true
}
}
}
Set defaults by data source or visualization type
You can set defaults for data sources by data source type without using the global field. For example:
"defaults": {
"ds.search": {
"options": {
"refresh": "3s",
"queryParameters": {
"earliest": "-4h@m"
}
}
}
}