Create and maintain metric rollup policies through the REST API
When you reach the limit of what you can do with metric rollup policies through Splunk Web, and if you do not have access to the metric_rollups.conf
files for your Splunk implementation, you can create, update, and delete metric rollup policies through manual calls to the /catalog/metricstore/rollup
REST endpoint.
The following prerequisites apply to all of the procedures in this topic.
Prerequisites
- For an overview of metric rollup summaries and the policies that govern their creation, see Roll up metrics data for faster search performance and increased storage capacity.
- See the REST API User Manual for a broad overview of Splunk platform REST API concepts.
- The endpoints that are relevant to metric rollup policies are documented in the REST API Reference Manual:
- /catalog/metricstore/rollup - for creating new metric rollup policies
- /catalog/metricstore/rollup/{index} - for updating or deleting existing metric rollup policies.
Give metric rollup policies features that are unavailable through Splunk Web
Create metric rollup policies for apps other than Search & Reporting
By default, metric rollup policies that you create with Splunk Web are given the context of the Search & Reporting app. However, with a REST API call, you can create metric rollup policies in the context of any app you prefer.
To do this, use the /catalog/metricstore/rollup
endpoint and embed the app folder name in the endpoint URL. Follow this syntax:
https://localhost:8089/servicesNS/nobody/<app-name>/catalog/metricstore/rollup
This generates a metric rollup policy in the context of the named app. If you omit the app name, the Splunk platform defaults to search
, for the Search and Reporting app.
Here is an example of a REST call that creates a metric rollup policy for a Buttercup Games app. The metric rollup policy summarizes data on a source index named index_s and places it in two summaries on two target indexes.
curl -k -u admin:changeme https://localhost:8089/servicesNS/nobody/buttercupgames/catalog/metricstore/rollup -d name=index_s -d default_agg=avg#max -d dimension_list="app,region" -d dimension_list_type=included -d metric_overrides="foo2|count#avg,foo1|min#avg" -d summaries="1h|index_d_1h,1d|index_d_1d" -d metric_list="foo3,foo4" -d metric_list_type=excluded
For details about the POST request parameters in this REST call, see the entry for the catalog/metricstore/rollup endpoint in the REST API Reference Manual.