> ## Documentation Index
> Fetch the complete documentation index at: https://docs-xcor.paloaltonetworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Review aggregation rules

> Use the Aggregation Rules page to review your aggregation rules.

The Aggregation Rules page is a centralized location in Palo Alto Networks Cortex XCOR
to review all of your [rollup](https://docs-xcor.paloaltonetworks.com/control/shaping/shape-metrics/rules/rollup.md) and
[mapping](https://docs-xcor.paloaltonetworks.com/control/shaping/shape-metrics/rules/mapping.md) rules.

To open the page, click ** Go to admin view**. In the
navigation menu, select **
Optimization > Aggregation Rules**.

The page lists each rule type on its own tab:

* **Rollup rules:** Lists your rollup rules, with shaping impact data for each rule.
  This tab is selected by default.
* **Mapping rules:** Lists your mapping rules. This tab appears only when your tenant
  has at least one mapping rule. You can't create mapping rules from this page.

## Search and filter rules

Use the **Search rules** field to find a particular rule or group of rules. The search
matches each rule's name, slug, filters, status, policy and labels, output metric name, and last-modified date.
Dates match the format shown in the **Last modified** column.

Searches aren't case-sensitive. Separate multiple terms with spaces to return only
rules that match every term. For example, `kubelet discard` returns rules that contain
both `kubelet` and `discard`.

On the **Rollup rules** tab, use the **Status** menu to show **All** rules, or only
rules in **Preview** or **Enabled** mode.

## Rollup rules table

The **Rollup rules** table includes the following columns. To display a description
of a column, hold the pointer over the  information icon in the
column header.

* **Status:** The mode the rule is in, either **Preview** or **Enabled**. To learn
  about preview mode, see
  [Preview aggregation rule impact](https://docs-xcor.paloaltonetworks.com/control/shaping/shape-metrics/reduce-cardinality/shaping-impact.md).
* **Name:** The rule name.
* **Filter:** The names of the metrics or labels the rule matches. Filters can include
  both Prometheus and Graphite metrics.
* **Policy:** The rule's label policy. **Keep labels** indicates the rule preserves
  the listed labels and discards all others. **Discard labels** indicates the rule
  removes the listed labels and keeps all others. **Drop raw** indicates the rule
  deletes the raw metrics it matches.
* **Metric name:** The name of the output metric that the rule creates and persists
  to the database. In the output name, `{{ .MetricName }}` represents the name of the
  input metric.
* **Matched writes**, **Persisted impact**, **Efficiency**, and **Utility score:**
  The columns that make up the rule's [shaping impact](#shaping-impact).
* **Last modified:** The last time the rule was updated.

For more detail, see
[Rollup rule attributes](https://docs-xcor.paloaltonetworks.com/control/shaping/shape-metrics/rules/rollup.md#rollup-rule-attributes).

### Shaping impact

*Shaping impact* data shows the individual effect of each existing rule on your
metrics traffic, which helps you manage your traffic shape.

The following columns describe the shaping impact of a rule:

* **Matched writes:** The raw number of incoming data points per second matching the
  rule. If your organization uses
  [consumption-based pricing](https://docs-xcor.paloaltonetworks.com/administer/limits-licensing/licensing.md#metrics-consumption),
  this column is named **Matched datapoints**.
* **Persisted impact:** The change in total persisted data points per second as a
  result of the rule. This column doesn't appear if your organization uses
  consumption-based pricing.
* **Efficiency:** A measure of how effective the rule is in aggregating incoming
  data points, expressed as a percentage reduction in data points per second from
  incoming to aggregated data.
* **Utility score:** An aggregate number that indicates the relative usefulness of
  the output metric, determined by the number of references, executions, and unique
  users. A higher score means users include the output metric in their workflows. To
  learn more, see [Telemetry Usage Analyzer](https://docs-xcor.paloaltonetworks.com/investigate/analyze/usage.md).

Use shaping impact data for tasks like these:

* To reduce persisted data, look for rules that have low utility but add persisted
  data. Use the **Least Valuable (by Persisted Impact)** sort to find them. This sort
  isn't available if your organization uses consumption-based pricing.
* To clean up ineffective rules, look for rules that aren't aggregating data, or
  don't match incoming data points effectively. Use the **Least Effective** sort to
  find them.

### Sort your data

On the **Rollup rules** tab, use the sorting menu to order rules by their shaping
impact. The menu is set to **Custom** by default, and includes these options:

* **Least Effective:** Lists rules with the lowest rule efficiency first.
* **Most Effective:** Lists rules with the highest rule efficiency first.
* **Custom:** Sorts by the column you select in the table header.

To sort by a single column, click the column name. The **Filter** and **Policy**
columns don't support sorting. Clicking a column name sets the sorting menu to
**Custom**, and selecting any other sorting menu option clears the column sort.

If your organization doesn't use consumption-based pricing, the menu also includes
options that compare a rule's output metric utility to its cost:

* **Least Valuable (by Matched Impact):** Lists rules with the lowest output metric
  utility relative to their matched writes first.
* **Most Valuable (by Matched Impact):** Lists rules with the highest output metric
  utility relative to their matched writes first.
* **Least Valuable (by Persisted Impact):** Lists rules that add persisted data and
  have low output metric utility first.
* **Most Valuable (by Persisted Impact):** Lists rules that conserve persisted data
  and have high output metric utility first.

## Mapping rules table

The **Mapping rules** tab includes a table with the following columns:

* **Name:** The rule name.
* **Filter:** The names of the metrics or labels the rule matches.
* **Policy:** The resolution at which the rule stores matched metrics, shown as
  `sample <resolution>`. **Drop raw** indicates the rule deletes the raw metrics it
  matches.
* **Last modified:** The last time the rule was updated.

Click a column name to sort the table by that column. The **Filter** and **Policy**
columns don't support sorting.

## Add aggregation rules

On the **Rollup rules** tab, click **Create rule** to open the
**Create Aggregation Rule** drawer. Use the
[rollup rule creation procedure](https://docs-xcor.paloaltonetworks.com/control/shaping/shape-metrics/rules/rollup.md#create-a-rollup-rule)
to define the rule.

Cortex XCOR doesn't save rules you define in the drawer. Define the rule on the
**Visual editor** tab, and then select the **Code config** tab to copy the
configuration and apply it with [Terraform](https://docs-xcor.paloaltonetworks.com/tooling/infrastructure/terraform) or
[Chronoctl](https://docs-xcor.paloaltonetworks.com/tooling/chronoctl).

## Rule details

Click any rule in a table to open its details drawer. Click **Previous** or **Next**
to move between rules of the same type without closing the drawer.

The drawer header contains the following controls:

* **Add comment** or **View comments:** Opens the comments for the rule. When the rule
  has comments, the button label includes the number of comments.
* **View incoming metrics:** Opens the Live Telemetry Analyzer to
  [analyze the rule's incoming data](#analyze-incoming-metrics-or-labels).
* **Edit:** For rollup rules, [opens the rule in the editor](#edit-aggregation-rules).
* **View Configuration:** For mapping rules, displays the rule's code configuration.

### Rule configuration

The **Rule configuration** section lists the rule's settings, including its status,
last update time, filters, and whether it drops raw data. For rollup rules, the
section also lists the slug, label policy, output metric name, metric type,
aggregation, and interval.

To view the code configuration for a rule:

* For rollup rules, click **Edit**, and then select the **Code config** tab.
* For mapping rules, click **View Configuration**.

In the code configuration, select **API**, **Chronoctl**, or **Terraform** to set the
format of the definition. Copy the definition to your clipboard to create or update a
rule using supported creation methods.

### Shaping impact graphs

For rollup rules, the **Shaping impact** section displays a current value and a
historical graph for each of the following measures:

* **Matched writes:** The raw number of incoming data points per second (DPPS)
  matching the rule. If your organization uses consumption-based pricing, this
  measure is named **Matched datapoints**.
* **Persisted impact:** The change in total persisted data points per second as a
  result of the rule, as a percentage. The current value also displays the number of
  **DPPS added** or **DPPS conserved**. This measure doesn't appear if your
  organization uses consumption-based pricing.
* **Rule efficiency:** The percentage reduction in data points per second from
  incoming to aggregated data.
* **Utility score:** The output metric utility score over time.

The graphs display the last day of data by default. Use the time range selector to
change the period that the graphs display.

### Analyze incoming metrics or labels

To analyze the incoming data that a rule matches, open the rule's details drawer, and
then click **View incoming metrics**. The
[Live Telemetry Analyzer](https://docs-xcor.paloaltonetworks.com/investigate/analyze/telemetry-analyzer.md) opens and actively
profiles the metrics that match the rule's filters.

### Edit aggregation rules

For rollup rules, click **Edit** to open the rule in the editor, which contains the
rule's current settings. Make changes on the **Visual editor** tab, and then copy the
new configuration from the **Code config** tab. To update the rule, apply the new
configuration using Terraform or Chronoctl.


## Related topics

- [Review shaping rules impact](https://docs-xcor.paloaltonetworks.com/control/shaping/review-impact.md)
- [Preview aggregation rule impact](https://docs-xcor.paloaltonetworks.com/control/shaping/shape-metrics/reduce-cardinality/shaping-impact.md)
- [Optimize your telemetry data](https://docs-xcor.paloaltonetworks.com/control.md)
- [Use comments to provide context](https://docs-xcor.paloaltonetworks.com/navigate/comments.md)
- [Metric shaping rules](https://docs-xcor.paloaltonetworks.com/control/shaping/shape-metrics/rules.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.