# Academy Source: https://docs-xcor.paloaltonetworks.com/academy Self-paced training on Cortex XCOR and Palo Alto Networks Telemetry Pipeline, with links to related product documentation. XCOR Academy offers self-paced courses on observability workflows, platform features, and Palo Alto Networks Telemetry Pipeline. Open a course summary on this site, then continue in [XCOR Academy](https://learn.chronosphere.io/) for the full lab or video. Use product documentation for reference material; use XCOR Academy when you want a guided path through a topic. ## Course tracks > [card] [Introduction to Observability Platform](/academy/courses/introduction-to-observability-platform) > > Platform track: onboarding, dashboards, monitors, incident response, Lens, SLOs, and Terraform. > [card] [Introduction to PromQL](/academy/courses/introduction-to-promql) > > Metrics track: PromQL fundamentals, exploring and controlling metrics, sparse metrics, and query optimization. > [card] [Exploring Logs](/academy/courses/exploring-logs) > > Logs track: log querying and visualizations, advanced query labs, and logging control plane features. > [card] [Exploring Traces](/academy/courses/exploring-traces) > > Traces track: distributed tracing in the platform and trace datasets, behaviors, and sampling. > [card] [Palo Alto Networks Telemetry Pipeline](/academy/courses/chronosphere-telemetry-pipeline) > > Pipeline track: collect telemetry from sources, transform it, and route it to destinations. ## Take courses online > [card] [Browse all courses in XCOR Academy](https://learn.chronosphere.io/) > > Open the full course catalog and sign in to take labs in XCOR Academy. # Alert Response & Troubleshooting Source: https://docs-xcor.paloaltonetworks.com/academy/courses/alert-response-and-troubleshooting Est. ~20–40 minutes. This course covers the essentials for on-call engineers onboarding onto the Observability Platform. You'll explore common troubleshooting strategies for monitor configuration, and break down tools in Cortex XCOR for optimizing incident response, such as Differential Diagnosis. Finally, you'll learn how to identify if shaping and control rules are affecting raw telemetry data once they arrive in Cortex XCOR. Est. \~20–40 minutes. This course covers the essentials for on-call engineers onboarding onto the Observability Platform. You'll explore common troubleshooting strategies for monitor configuration, and break down tools in Cortex XCOR for optimizing incident response, such as Differential Diagnosis. Finally, you'll learn how to identify if shaping and control rules are affecting raw telemetry data once they arrive in Cortex XCOR. > [card] [Take Alert Response & Troubleshooting in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Overview of alerting](/investigate/alerts) * [Respond to incidents](/overview/guides/incident-response) # Applying Budgets to Partitions Source: https://docs-xcor.paloaltonetworks.com/academy/courses/applying-budgets-to-partitions Est. 15 to 20 minutes. Configure budgets and interpret partition consumption against thresholds. Est. 15 to 20 minutes. Configure budgets and interpret partition consumption against thresholds. > [card] [Take Applying Budgets to Partitions in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Telemetry data budgets](/control/consumption/budgeting) * [Partitions](/control/consumption/partitions) * [Manage telemetry data budgets](/overview/guides/manage-budgets) # Building Dynamic Dashboards Source: https://docs-xcor.paloaltonetworks.com/academy/courses/building-dynamic-dashboards Est. ~20–40 minutes. In this course, you will learn how to transform chaotic data into high-value insights. The course covers strategy for avoiding common dashboard pitfalls, as well as the technical tools that Cortex XCOR provides to build clear, dynamic, and actionable dashboards. Est. \~20–40 minutes. In this course, you will learn how to transform chaotic data into high-value insights. The course covers strategy for avoiding common dashboard pitfalls, as well as the technical tools that Cortex XCOR provides to build clear, dynamic, and actionable dashboards. > [card] [Take Building Dynamic Dashboards in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Visualize data using dashboards](/observe/dashboards) # Palo Alto Networks Telemetry Pipeline Source: https://docs-xcor.paloaltonetworks.com/academy/courses/chronosphere-telemetry-pipeline Est. ~2 hours. Learn the fundamentals of Palo Alto Networks Telemetry Pipeline. You will build pipelines that collect telemetry data from a variety of sources, transform it, and route the data to various destinations. Est. \~2 hours. Learn the fundamentals of Palo Alto Networks Telemetry Pipeline. You will build pipelines that collect telemetry data from a variety of sources, transform it, and route the data to various destinations. > [card] [Take Palo Alto Networks Telemetry Pipeline in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Palo Alto Networks Telemetry Pipeline](/pipeline) # Configuring Services with Lens Source: https://docs-xcor.paloaltonetworks.com/academy/courses/configuring-services-with-lens Est. ~20–40 minutes. This course provides a comprehensive guide to building a service-centric view of your environment using Cortex XCOR Services. You'll learn a four-step workflow to transform raw telemetry, such as OpenTelemetry and Prometheus, into actionable insights by discovering services, refining data with merge rules, and customizing service presentations. Finally, you'll master advanced configurations like pod mapping to ensure every service is accurately represented in your unified system view. Est. \~20–40 minutes. This course provides a comprehensive guide to building a service-centric view of your environment using Cortex XCOR Services. You'll learn a four-step workflow to transform raw telemetry, such as OpenTelemetry and Prometheus, into actionable insights by discovering services, refining data with merge rules, and customizing service presentations. Finally, you'll master advanced configurations like pod mapping to ensure every service is accurately represented in your unified system view. > [card] [Take Configuring Services with Lens in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Services](/observe/services) # Controlling Logs Source: https://docs-xcor.paloaltonetworks.com/academy/courses/controlling-logs Est. ~20–40 minutes. Become versed in the Control Plane features of Logging in our Observability Platform. Explore concepts like partitions, control rules and budgets. Learn how to take advantage of the utilization analysis page in Cortex XCOR to make decisions about your log data. Est. \~20–40 minutes. Become versed in the Control Plane features of Logging in our Observability Platform. Explore concepts like partitions, control rules and budgets. Learn how to take advantage of the utilization analysis page in Cortex XCOR to make decisions about your log data. > [card] [Take Controlling Logs in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Shape your log data](/control/shaping/shape-logs) # Controlling Metrics Source: https://docs-xcor.paloaltonetworks.com/academy/courses/controlling-metrics Est. ~20–40 minutes. Dive into the fundamentals of controlling your metric data and cutting costs without compromising visibility. Learn how to use Cortex XCOR features to understand the utility of your data, apply shaping rules, and monitor usage and value over time. Est. \~20–40 minutes. Dive into the fundamentals of controlling your metric data and cutting costs without compromising visibility. Learn how to use Cortex XCOR features to understand the utility of your data, apply shaping rules, and monitor usage and value over time. > [card] [Take Controlling Metrics in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Shape metric data](/control/shaping/shape-metrics) # Controlling Traces Source: https://docs-xcor.paloaltonetworks.com/academy/courses/controlling-traces Est. ~20–40 minutes. Explore more control features, this time for traces! You'll learn to create datasets and assign behaviors to those datasets to sample traces for datasets. Est. \~20–40 minutes. Explore more control features, this time for traces! You'll learn to create datasets and assign behaviors to those datasets to sample traces for datasets. > [card] [Take Controlling Traces in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Sample your traces](/control/shaping/sample-traces) # Creating & Tuning Monitors Source: https://docs-xcor.paloaltonetworks.com/academy/courses/creating-and-tuning-monitors Est. ~20–40 minutes. Learn the ins and outs of alerting in Cortex XCOR, from templating notifications, to setting up monitor queries, to configuring signals, to iterating on conditions based on simulation and visualizations. Est. \~20–40 minutes. Learn the ins and outs of alerting in Cortex XCOR, from templating notifications, to setting up monitor queries, to configuring signals, to iterating on conditions based on simulation and visualizations. > [card] [Take Creating & Tuning Monitors in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Overview of alerting](/investigate/alerts) # Creating & Tuning SLOs Source: https://docs-xcor.paloaltonetworks.com/academy/courses/creating-and-tuning-slos Est. ~20–40 minutes. How reliable is "reliable enough"? This course teaches you how to establish operational boundaries that balance system stability with feature velocity using Service Level Objectives (SLOs). You will learn how to define specific target percentages that protect the user experience without bottlenecking your development pipeline. This course is dedicated strictly to the implementation and management of Error Ratio SLOs within the platform. Est. \~20–40 minutes. How reliable is "reliable enough"? This course teaches you how to establish operational boundaries that balance system stability with feature velocity using Service Level Objectives (SLOs). You will learn how to define specific target percentages that protect the user experience without bottlenecking your development pipeline. This course is dedicated strictly to the implementation and management of Error Ratio SLOs within the platform. > [card] [Take Creating & Tuning SLOs in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Service level objectives](/observe/slo) * [Manage service level objectives](/investigate/alerts/manage-slos) # Designing Partitions Source: https://docs-xcor.paloaltonetworks.com/academy/courses/designing-partitions Est. ~15–20 minutes. Partitions are hierarchical groupings used to categorize data and govern credit consumption with Consumption Pricing in Cortex XCOR. Take this course to learn how partitions categorize metrics, logs, and traces, to design a multi-level structure that matches your organization, and to navigate the UI to generate a consumption configuration. Est. \~15–20 minutes. Partitions are hierarchical groupings used to categorize data and govern credit consumption with Consumption Pricing in Cortex XCOR. Take this course to learn how partitions categorize metrics, logs, and traces, to design a multi-level structure that matches your organization, and to navigate the UI to generate a consumption configuration. > [card] [Take Designing Partitions in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Partitions](/control/consumption/partitions) # Exploring Logs Source: https://docs-xcor.paloaltonetworks.com/academy/courses/exploring-logs Est. ~20–40 minutes. Familiarize yourself with log querying and analysis tooling in the Observability Platform. Learn about log querying syntax, log visualizations for dashboards, and creating monitors to alert on log data. Est. \~20–40 minutes. Familiarize yourself with log querying and analysis tooling in the Observability Platform. Learn about log querying syntax, log visualizations for dashboards, and creating monitors to alert on log data. > [card] [Take Exploring Logs in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Ingest, query, and control your log data](/overview/types/logs) * [Search and filter log data](/investigate/querying/query-logs) # Exploring Logs 201 Source: https://docs-xcor.paloaltonetworks.com/academy/courses/exploring-logs-201 Est. ~20–40 minutes. This 200-level course is a purely hands-on deep dive into writing advanced queries within Cortex XCOR. Designed for users who already know their way around the Logs Explorer, this course focuses entirely on using query logic to troubleshoot issues and extract actionable insights. Est. \~20–40 minutes. This 200-level course is a purely hands-on deep dive into writing advanced queries within Cortex XCOR. Designed for users who already know their way around the Logs Explorer, this course focuses entirely on using query logic to troubleshoot issues and extract actionable insights. > [card] [Take Exploring Logs 201 in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Search and filter log data](/investigate/querying/query-logs) # Exploring Metrics Source: https://docs-xcor.paloaltonetworks.com/academy/courses/exploring-metrics Est. ~20–40 minutes. You're sending metric data to Cortex XCOR — now what?! This course goes over the basics of querying metrics, even if you haven't done any learning on PromQL. It also covers anomaly detection using Differential Diagnosis for Metrics. Est. \~20–40 minutes. You're sending metric data to Cortex XCOR — now what?! This course goes over the basics of querying metrics, even if you haven't done any learning on PromQL. It also covers anomaly detection using Differential Diagnosis for Metrics. > [card] [Take Exploring Metrics in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Ingest, query, and control your metric data](/overview/types/metrics) * [Search and query telemetry data](/investigate/querying) # Exploring Services with Lens Source: https://docs-xcor.paloaltonetworks.com/academy/courses/exploring-services-with-lens Est. ~20–40 minutes. This course provides a foundational look at navigating the service-centric landscape in Cortex XCOR. You'll learn to consolidate fragmented telemetry into a unified view to streamline troubleshooting without switching between disconnected tools. You will explore how to use the Services Page to manage high-volume environments and the My Services section to prioritize data relevant to your specific team. Finally, you'll gain hands-on experience through interactive labs to master service discovery and dashboard interaction. Est. \~20–40 minutes. This course provides a foundational look at navigating the service-centric landscape in Cortex XCOR. You'll learn to consolidate fragmented telemetry into a unified view to streamline troubleshooting without switching between disconnected tools. You will explore how to use the Services Page to manage high-volume environments and the My Services section to prioritize data relevant to your specific team. Finally, you'll gain hands-on experience through interactive labs to master service discovery and dashboard interaction. > [card] [Take Exploring Services with Lens in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Services](/observe/services) # Exploring SLOs Source: https://docs-xcor.paloaltonetworks.com/academy/courses/exploring-slos Est. ~20–40 minutes. This course focuses on the high-pressure moments when an SLO alert triggers and your error budget begins to burn. You'll learn to navigate the SLO Detail page in Cortex XCOR to quickly assess incident severity, track reliability trends, and pinpoint root causes. By leveraging your existing knowledge of monitors and notification policies, you will gain the tactical skills necessary to move from a paged state to a decisive, informed response. Est. \~20–40 minutes. This course focuses on the high-pressure moments when an SLO alert triggers and your error budget begins to burn. You'll learn to navigate the SLO Detail page in Cortex XCOR to quickly assess incident severity, track reliability trends, and pinpoint root causes. By leveraging your existing knowledge of monitors and notification policies, you will gain the tactical skills necessary to move from a paged state to a decisive, informed response. > [card] [Take Exploring SLOs in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Service level objectives](/observe/slo) * [Manage service level objectives](/investigate/alerts/manage-slos) # Exploring Traces Source: https://docs-xcor.paloaltonetworks.com/academy/courses/exploring-traces Est. ~20–40 minutes. This course is a guide to distributed tracing in Cortex XCOR, which is essential for analyzing and troubleshooting requests across complex distributed systems. You'll learn to describe the components of a trace and leverage Cortex XCOR to explore and use trace data to pinpoint application slowdowns or errors. Est. \~20–40 minutes. This course is a guide to distributed tracing in Cortex XCOR, which is essential for analyzing and troubleshooting requests across complex distributed systems. You'll learn to describe the components of a trace and leverage Cortex XCOR to explore and use trace data to pinpoint application slowdowns or errors. > [card] [Take Exploring Traces in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Ingest, query, and control your trace data](/overview/types/traces) * [Search and filter trace data](/investigate/querying/traces) # Introduction to Consumption Pricing Source: https://docs-xcor.paloaltonetworks.com/academy/courses/introduction-to-consumption-pricing Est. ~15–20 minutes. This course is a great first step in understanding Consumption Pricing in Cortex XCOR at a high level. Learn about resource pricing, the purpose of partitions and budgets, and the pages in the UI that will give you overall visibility into your organization's usage. Est. \~15–20 minutes. This course is a great first step in understanding Consumption Pricing in Cortex XCOR at a high level. Learn about resource pricing, the purpose of partitions and budgets, and the pages in the UI that will give you overall visibility into your organization's usage. > [card] [Take Introduction to Consumption Pricing in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Manage consumption](/control/consumption) # Introduction to Observability Platform Source: https://docs-xcor.paloaltonetworks.com/academy/courses/introduction-to-observability-platform Est. ~20–40 minutes. If you're onboarding onto our Observability Platform, this is a great place to start to learn how to navigate. Through a virtual lab, you'll take an interactive tour through a playground tenant that you'll revisit in future courses. Est. \~20–40 minutes. If you're onboarding onto our Observability Platform, this is a great place to start to learn how to navigate. Through a virtual lab, you'll take an interactive tour through a playground tenant that you'll revisit in future courses. > [card] [Take Introduction to Observability Platform in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Get started with Cortex XCOR](/overview/get-started) * [Navigate the Cortex XCOR interface](/navigate) # Introduction to PromQL Source: https://docs-xcor.paloaltonetworks.com/academy/courses/introduction-to-promql Est. ~2 hours. Explore the foundations of the Prometheus Query Language (PromQL) and how you can use it to extract meaningful, actionable intelligence from your time series data. This is the 101 course, and it does not assume any prior knowledge of Prometheus. Est. \~2 hours. Explore the foundations of the Prometheus Query Language (PromQL) and how you can use it to extract meaningful, actionable intelligence from your time series data. This is the 101 course, and it does not assume any prior knowledge of Prometheus. > [card] [Take Introduction to PromQL in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Search and query telemetry data](/investigate/querying) # Investigating Consumption Increases Source: https://docs-xcor.paloaltonetworks.com/academy/courses/investigating-consumption-increases Est. ~15–20 minutes. Once your organization has partitions and budgets configured, this course is the perfect follow-up when credits climb or budgets fire. You'll explore how Cortex XCOR offers various angles for identifying the radius of the issue and determining next steps. Est. \~15–20 minutes. Once your organization has partitions and budgets configured, this course is the perfect follow-up when credits climb or budgets fire. You'll explore how Cortex XCOR offers various angles for identifying the radius of the issue and determining next steps. > [card] [Take Investigating Consumption Increases in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Analyze consumption](/control/consumption/analyze) * [Manage consumption](/control/consumption) # Managing Resources with Terraform Source: https://docs-xcor.paloaltonetworks.com/academy/courses/managing-resources-with-terraform Est. ~15–30 minutes. Whether it's your first time using Terraform or you're a seasoned expert, this course offers a path for you to learn the relevant details for using the Terraform provider. The course begins with an optional introduction to Terraform, and it ends with a hands-on lab allowing you to practice provider set-up and refactoring resource files with modules. Est. \~15–30 minutes. Whether it's your first time using Terraform or you're a seasoned expert, this course offers a path for you to learn the relevant details for using the Terraform provider. The course begins with an optional introduction to Terraform, and it ends with a hands-on lab allowing you to practice provider set-up and refactoring resource files with modules. > [card] [Take Managing Resources with Terraform in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Cortex XCOR Terraform provider](/tooling/infrastructure/terraform) # PromQL 201 Source: https://docs-xcor.paloaltonetworks.com/academy/courses/promql-201 Est. ~2 hours. Build on your PromQL fundamentals to make sense of complex queries, and craft your own. This course focuses on vector matching, logical operators, aggregations over time and a few other helpful functions. Est. \~2 hours. Build on your PromQL fundamentals to make sense of complex queries, and craft your own. This course focuses on vector matching, logical operators, aggregations over time and a few other helpful functions. > [card] [Take PromQL 201 in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Search and query telemetry data](/investigate/querying) # Query Optimization for Metrics Source: https://docs-xcor.paloaltonetworks.com/academy/courses/query-optimization-for-metrics Est. ~2 hours. Dive into recording rules and derived telemetry to learn how they can help with query optimization. Learn how to identify the right optimization tool for your team's use case. Est. \~2 hours. Dive into recording rules and derived telemetry to learn how they can help with query optimization. Learn how to identify the right optimization tool for your team's use case. > [card] [Take Query Optimization for Metrics in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Search and query telemetry data](/investigate/querying) * [Shape metric data](/control/shaping/shape-metrics) # SLO Detail: Quick Tour Source: https://docs-xcor.paloaltonetworks.com/academy/courses/slo-detail-quick-tour Est. ~5 minutes. This course provides a high-level walkthrough of the SLO Detail page, your central hub for monitoring service health against reliability goals. You'll explore the key sections of this comprehensive interface to understand how to track performance and investigate service-level issues in real-time. By the end of this tour, you will know exactly where to find the data needed to monitor your service effectively and maintain your defined objectives. Est. \~5 minutes. This course provides a high-level walkthrough of the SLO Detail page, your central hub for monitoring service health against reliability goals. You'll explore the key sections of this comprehensive interface to understand how to track performance and investigate service-level issues in real-time. By the end of this tour, you will know exactly where to find the data needed to monitor your service effectively and maintain your defined objectives. > [card] [Take SLO Detail: Quick Tour in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Service level objectives](/observe/slo) * [Manage service level objectives](/investigate/alerts/manage-slos) # Trusting Alerts: Troubleshooting Monitor Configuration Source: https://docs-xcor.paloaltonetworks.com/academy/courses/trusting-alerts-troubleshooting-monitor-configuration Est. ~15 minutes. The task of setting up monitors and tuning their thresholds is hardly trivial. This course focuses on strategies for tweaking monitors so that an alert triggers when a real problem exists. Est. \~15 minutes. The task of setting up monitors and tuning their thresholds is hardly trivial. This course focuses on strategies for tweaking monitors so that an alert triggers when a real problem exists. > [card] [Take Trusting Alerts: Troubleshooting Monitor Configuration in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Overview of alerting](/investigate/alerts) # Working with Sparse Metrics Source: https://docs-xcor.paloaltonetworks.com/academy/courses/working-with-sparse-metrics Est. ~15 minutes. This mini course explores the distinct challenges of working with metrics that don't report values at a regular interval. After exploring fundamental concepts about lookback windows and what it means to be sparse, learners will leave with several strategies in their toolbox for mitigating challenges with sparse metrics. Est. \~15 minutes. This mini course explores the distinct challenges of working with metrics that don't report values at a regular interval. After exploring fundamental concepts about lookback windows and what it means to be sparse, learners will leave with several strategies in their toolbox for mitigating challenges with sparse metrics. > [card] [Take Working with Sparse Metrics in XCOR Academy](https://learn.chronosphere.io/) ## Related documentation * [Search and query telemetry data](/investigate/querying) # Administer your tools and users Source: https://docs-xcor.paloaltonetworks.com/administer Palo Alto Networks Cortex XCOR offers tools and guidance for managing users, teams, collections, and your infrastructure-as-code settings. Administrative users focus on observability tools so that developers can use those tools to monitor and maintain the health of their distributed system. As an administrative user, you might focus on one or more of the following tasks. ## Cost control Track telemetry usage against your contract with the [License Overview](/administer/limits-licensing/licensing), which surfaces consumption snapshots and trends for each telemetry type. To investigate what's driving growth, [analyze consumption](/control/consumption/analyze) across partitions and budgets. Then use the [Control Plane](/control/shaping) to shape, sample, and reduce the data you persist. ## Data collection [Ingest telemetry data](/ingest) into Palo Alto Networks Cortex XCOR, which can include metrics, traces, and change events. Your Collector selection depends on the data you plan to ingest. Cortex XCOR recommends using the Chronosphere Collector, but can also ingest data from the OpenTelemetry Collector. ## Data usability [Explore your data](/investigate) to understand where you can normalize, sanitize, and optimize telemetry data to make it usable for developers and to filter out less actionable data. [Analyze usage metrics](/overview/types/metrics) and implement aggregation rules to improve the quality and reduce the cardinality of stored metrics data. ## Service level objectives Define [service level objectives](/observe/slo) (SLOs) that measure your services' availability from your users' perspective. Effective SLOs combine user-focused indicators, realistic objectives based on historical performance, and tuned burn rate alerts that help responders react before error budgets are exhausted. [Design service level objectives](/administer/design-slos) to choose the right indicators, set realistic objectives, and configure burn rate alerts for your services. ## Command Center Organize SLOs into [Command Center groups](/administer/command-center-groups) to define the business units shown in the [Command Center](/observe/command-center). Each group tracks a primary SLO and optional related SLOs. Groups without a primary SLO don't appear in the Command Center. ## Platform usability Create and manage [collections](/administer/collections) to group Cortex XCOR resources associated with a service or feature you want to monitor. You create [teams](/administer/accounts-teams/teams) to organize accounts into groups and define permissions for sensitive management and administrative operations. A team's accounts have shared responsibility for individual services, which Cortex XCOR represents as collections. # Accounts and teams Source: https://docs-xcor.paloaltonetworks.com/administer/accounts-teams Palo Alto Networks Cortex XCOR lets you manage user accounts, roles, and team permissions for streamlined access and collaboration. Palo Alto Networks Cortex XCOR identifies users and services by their *accounts*. As an administrator, you can organize accounts into *teams* and define those teams' permissions. * A [*user account*](/administer/accounts-teams/user-accounts) represents a user's identity in Cortex XCOR. * A [*service account*](/administer/accounts-teams/service-accounts) represents a service's identity in Cortex XCOR. * A [*team*](/administer/accounts-teams/teams) organizes accounts into groups and defines permissions for sensitive management and administrative operations. Add accounts to teams based on the permissions you want grant to those accounts. For example, to make a user or service account an *administrator*, assign it to a team that has the SysAdmin role. This grants the account access to special Cortex XCOR features, including team and account management and assignment. ## View accounts and teams > [tab] Web - accounts > > In the navigation menu, click ** Go to admin view** and then select > **Platform > Users**. > > The left-hand column lists all accounts. The list includes icons for > additional context about each entry type: > > | Icon | Description | > | :-: | - | > | | An active user account. | > | | A service account. | > | | An invited user who's yet to confirm their account. | > | | A deactivated user account. | > > A **System Administrator** icon to the right of an entry > indicates either a team that has the System Administrator (SysAdmin) role, or > a user or service account that's a member of a team with that role. > > To view details about an account, select its name from the list. To filter by > account name, enter part or all of the account's name in the **Search** field. > To filter by account type or status, click the filter icon. > > When you select an account, Cortex XCOR displays the account's team > **Memberships** and **Recent User Actions**. > > If your user account belongs to a team with the SysAdmin role, this view also > provides options to add or remove the account from teams. > [tab] Web - teams > > In the navigation menu, click ** Go to admin view** and then select > **Platform > Teams**. > > The table lists all teams by name and other details about their configuration: > > * **Role**: The role granted to all accounts in the team. The SysAdmin role > grants administrative privileges. > * **Source**: The source of this team's configuration. **UI** teams are > configured in Cortex XCOR and can be edited in the app by users with > the SysAdmin role. **Terraform** teams are configured exclusively through > Terraform. > * **Description**: A description of the team. > > To view a team's [home page](/administer/collections/home), click > its name in the list. If your user account is part of a team with the SysAdmin > role, you can edit the team's name, role, description, links, and membership > from its home page. > [tab] Chronoctl > > You can use [Chronoctl](/tooling/chronoctl) to list teams and their member accounts. > This output includes the email address associated with each account. If an account's > email address is an alphanumeric Cortex XCOR > slug at the `serviceaccount.chronosphere.io` domain, that > member is a [service account](/administer/accounts-teams/service-accounts). Other > email addresses represent user accounts. > > > [!NOTE] > > > > To view accounts and teams with Chronoctl, you must authenticate as a user > > that belongs to a team with the SysAdmin role, or as an unrestricted > > [service account](/administer/accounts-teams/service-accounts). > > To list each team and its member accounts in separate YAML documents with > [Chronoctl](/tooling/chronoctl), use the `teams list` command. You can also use > this output as a template for updating each team separately using Chronoctl. > > ```shell theme={null} > chronoctl teams list > ``` > > The output contains YAML documents separated by three dashes (`---`). Each document > contains one team and any of its member accounts. > > For example, this output lists a team named *Control team* with one user account > and one service account as members, and a second team named *DBAs* with two > user account members: > > ```yaml Chronoctl example icon="square-terminal" theme={null} > api_version: v1/config > kind: Team > spec: > slug: control-team > name: Control team > user_emails: > - adam@example.com > - 4a5842df-4179-47c7-bcc0-d1e6589caaf0@serviceaccount.chronosphere.io > --- > api_version: v1/config > kind: Team > spec: > slug: dbas > name: DBAs > user_emails: > - adam@example.com > - betty@example.com > ``` > [tab] API > > To list all teams with the Cortex XCOR API, use the > [`ListTeams`](/tooling/api-info/definition/operations/ListTeams) endpoint. > > To view a single team, use the > [`ReadTeams`](/tooling/api-info/definition/operations/ReadTeam) endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Grant System Administrator (SysAdmin) privileges to a team A user account that's a member of a [team](/administer/accounts-teams/teams) with the `SysAdmin` role has administrative access to Cortex XCOR features, including the abilities to create teams and user accounts, assign users to teams, and define team permissions. For instructions about assigning roles to a team, see [Add a role to a team](/administer/accounts-teams/teams#add-a-role-to-a-team). # Okta user synchronization Source: https://docs-xcor.paloaltonetworks.com/administer/accounts-teams/okta Configure user synchronization between Okta and Palo Alto Networks Cortex XCOR. [System for Cross-domain Identity Management (SCIM)](https://en.wikipedia.org/wiki/System_for_Cross-domain_Identity_Management) is a standard used to automate exchanges of user identity details between identity systems or Identity Providers (IdP), like Okta. It's used to deprovision, update, and provision users. SCIM integration helps you control user access in Palo Alto Networks Cortex XCOR. This document applies to existing customers using Okta who want to use SCIM. New customers can configure SCIM when moving to Cortex XCOR. After migrating to SCIM, Cortex XCOR Support sends you a list of users not managed by SCIM. On a case-by-case basis, determine if a user should be deactivated, or if the user is still active but has a new email address. Your Cortex XCOR team manually remediates these issues to complete the migration process. ## Setup Setting up SCIM with Okta requires configuration in both Cortex XCOR and the Okta dashboard. ### Prepare Cortex XCOR for SCIM integration > [!NOTE] > > Setting up SCIM with Okta requires a user with Okta super administrator access and a > user with Cortex XCOR SysAdmin permissions. These accounts can be the same > user. Before proceeding with Okta integration, complete the following steps: 1. Contact Cortex XCOR Support to enable SCIM integration for Okta Workforce for your application. > [!WARNING] > > After Cortex XCOR Support enables SCIM integration, new users won't be able to > access Cortex XCOR until the setup process is complete. 2. [Create an unrestricted service account in Cortex XCOR](/administer/accounts-teams/service-accounts#create-an-unrestricted-service-account). You must be a member of a team with the SysAdmin role to create a new service account. For the **New Service Account Name**, Cortex XCOR recommends a meaningful service account name like `Okta SCIM integration`. 3. Copy the token to a safe place, as it's provided only once, and can't be displayed or recovered later. 4. In Cortex XCOR, [create a new, distinct team](/administer/accounts-teams/teams) for the purpose of SCIM administration. 5. Assign the [**User Administrator** role to the team](/administer/accounts-teams/teams#add-a-role-to-a-team). For security, Cortex XCOR recommends only this team be assigned the **User Admin** role, and the role be specifically scoped to only have permission to communicate with the SCIM API, or have access to the service token. 6. Add the service account user you created. ### Configure SCIM integration on Okta Your organization's Okta administrator must configure Okta provisioning integration. Find general instructions for setting up Okta integration in the [Okta documentation](https://developer.okta.com/docs/guides/scim-provisioning-integration-connect/main/). 1. Using an administrator account, sign in to the Okta app to be used for single sign-on (SSO) integration with Cortex XCOR. 2. Next to your username, click **Admin**. 3. In the left sidebar menu, go to **Applications > Applications**. 4. In the **General** tab, next to **Provisioning**, select **SCIM** and then click **Save**. 5. Click the **Provisioning** tab. 6. Click **Integration**, and then click **Edit**. 7. Enter information for the following fields: * **SCIM connector base URL:** `https://TENANT.chronosphere.io/api/scim/v2`. Replace *`TENANT`* with the name of your Cortex XCOR tenant. * **Unique identifier field for users:** Enter `email`. * **Supported provisioning actions:** Select only these values: * **Push New Users** * **Push Profile Updates** 8. For **Authentication Mode**, select `HTTP Header`. 9. For the **Authorization** section's **Bearer** field, copy and paste the service token obtained when creating a service account in the Cortex XCOR console. 10. Click **Test Connector Configuration** to ensure the integration configuration is correct. If you encounter an error message, review the configuration and try again. 11. Click **Save** to save the configuration. The **Provisioning to App** page displays. 12. Select the **Enable** checkboxes for **Create Users** and **Update User Attributes**. 13. Click **Save**. > [!WARNING] > > You must complete both step 7 (select **Push new users**), and step 12 (Enable the > checkbox for **Create Users**). Provisioning fails if either of these steps isn't > completed. ### Update the Cortex XCOR default group in Okta After completing SCIM integration setup process and connecting to Cortex XCOR, sync the existing users in your Okta tenant with Cortex XCOR. To do this, you must first remove all assigned users and groups, and then reassign them. 1. Sign in to Okta. 2. Click **Admin**. 3. In the left sidebar menu, go to **Applications > Applications**. 4. In the **Provisioning** tab, clear the **Deactivate Users** checkbox. > [!NOTE] > > Clear this checkbox before updating the group. 5. Navigate to the **Assignments** tab and then select **Groups**. 6. To remove all **Existing Groups**, click the **X** icon next to each group. 7. Click the **Assign** button and reassign all **Existing Groups**. 8. Navigate to the **Provisioning** tab, and then click **Edit**. 9. Select the **Deactivate Users** checkbox. The SCIM integration setup is now complete and users will be provisioned and deprovisioned by Cortex XCOR. ### Verify successful provisioning After completing the setup process, verify the provisioning process succeeded. 1. In Okta, navigate to **Dashboard -> Tasks**. 2. Look for failed requests. These display as `Application assignments encountered errors`. 3. Retry any failed requests. If failures persist, contact [Cortex XCOR Support](/support). It's a good practice to review for failed requests whenever deactivating users or changing users assigned to Cortex XCOR. Use [Okta Workflows](https://help.okta.com/wf/en-us/Content/Topics/Workflows/use-case-lifecycle-event-notification.htm) to send notifications when provisioning or deprovisioning fails. ## Deprovisioned users When a user is deprovisioned, personal access tokens and any outstanding credentials they had from Cortex XCOR no longer work. > [!WARNING] > > SCIM deactivates users from the time of enablement, but won't deactivate existing users who are > no longer assigned to or were removed from the Cortex XCOR app. Group memberships remain intact, and [service accounts](/administer/accounts-teams/service-accounts) continue to function. Cortex XCOR doesn't revoke service accounts created by a given user during user deactivation. Service accounts can be used in production, and deactivating them can cause outages. This is consistent with other web services, such as Amazon Web Services and Google Cloud Platform, where service accounts aren't tied to a user. # Personal access tokens Source: https://docs-xcor.paloaltonetworks.com/administer/accounts-teams/personal-access-tokens Use personal access tokens to securely access the Cortex XCOR API, Chronoctl, and Terraform. A user can create a *personal access token* to authenticate their user account with the Cortex XCOR API, Chronoctl, and Terraform. When you authenticate with a personal access token, Palo Alto Networks Cortex XCOR associates the actions you take with your identity and respects the permissions granted to your user account's team. Unlike creating service accounts, you don't need to be a member of a team with the SysAdmin role to create a personal access token. For details about user accounts and teams, see [Accounts and Teams](/administer/accounts-teams). For details about signing in to Cortex XCOR in a web browser, see [Authenticating with Cortex XCOR](/overview/authenticating). A personal access token expires and stops working after a defined period of up to 30 days. You can't use a personal access token as an API token for the Chronosphere Collector. To create a persistent identity for a service, define permissions for it, and provide it with an API token, use a [service account](/administer/accounts-teams/service-accounts). ## Create a personal access token To create a personal access token: 1. Click your profile icon from the menu bar and select **My Account**. 2. Click **+ Add Token** to open the **Add Token** window. 3. Enter a name for the personal access token. 4. In the **Token Expiration** dropdown, select a token duration in days. 5. Click **Generate Token** to save the personal access token. 6. Copy the resulting API token. > [!WARNING] > > Store the API token securely, because it's as sensitive as your password. If you > don't store the API token immediately after creation, you can't view it after > navigating away from the **My Account** page. If you lose the API token, you must > create a new personal access token. ## Use a personal access token You can use the API token generated by your personal access token with Chronoctl or the Cortex XCOR API to access the same things you can access in the Cortex XCOR web app. For details, see the [Chronoctl](/tooling/chronoctl), [Prometheus API](/tooling/prometheus-api), and [Cortex XCOR API](/tooling/api-info) documentation. ## Revoke personal access tokens Cortex XCOR invalidates each personal access token and its associated API token upon expiration. You can also manually revoke personal access tokens that you've created. > [!WARNING] > > When you revoke a personal access token, Cortex XCOR removes it and its > associated API token immediately without any additional confirmation. To revoke a token: 1. Click your profile icon from the menu bar and select **My Account**. 2. On the row of the token you want to revoke, click ** Revoke**. To revoke all of your tokens: 1. Click your profile icon from the menu bar and select **My Account**. 2. Click **Revoke All**. # Service accounts Source: https://docs-xcor.paloaltonetworks.com/administer/accounts-teams/service-accounts An explanation of Cortex XCOR service accounts and usage. A *service account* provides an identity that a service can use to access the Cortex XCOR API, Chronoctl, Terraform, and the Chronosphere Collector. Use service accounts for automated, programmatic interactions, such as CI/CD, ingesting telemetry, or automated queries. Palo Alto Networks Cortex XCOR attributes all actions that a service takes to its service account. A service account can't access the user interface, only the APIs. Accounts can belong to [*teams*](/administer/accounts-teams/teams). When you create a service account, Cortex XCOR also creates a non-expiring API token that the service account uses for authentication. > [!NOTE] > > Service accounts are distinct from [*user accounts*](/administer/accounts-teams/user-accounts), > which provide identities for users who can also authenticate interactively and use > Cortex XCOR. > > To use tools that require non-interactive authentication, such as Chronoctl, > Terraform, or the Cortex XCOR API, create a temporary > [personal access token](/administer/accounts-teams/personal-access-tokens) with the > same permissions as your user account. You can also assign service accounts to teams > with the `SysAdmin` role, which also grants those service accounts administrative > permissions. > > For details about accounts and teams, see > [Accounts and Teams](/administer/accounts-teams). > For details about interactive user account authentication, see > [Authenticating with Cortex XCOR](/overview/authenticating). ## View service accounts > [tab] Web > > In the navigation menu, click ** Go to admin view** and > then select **Platform > Service Accounts**. > > The service account list contains the following information: > > * **Name:** The service account name. > * **Service account email:** The unique email user for this service account. > * **Created by:** The service account creator. > * **Restriction:** The type of > [restrictions](/administer/accounts-teams/service-accounts#create-a-restricted-service-account) > on this account. Unrestricted accounts don't have a value here. > * **Last used:** When this service token was last accessed. This field can be > inaccurate if more than 1,000 service accounts are active. > * **Metric label:** For restricted accounts, the key-value label pair restriction. > [tab] Chronoctl > > To return all service accounts and their label restrictions, use the [Chronoctl](/tooling/chronoctl) > `service-accounts list` command. > > For example, to return all service accounts in JSON format, run: > > ```shell theme={null} > chronoctl service-accounts list --output=json > ``` > > The command returns the following fields for each service account: > > * `id`: The unique identifier for the service account. The `slug` field > contains the same value. > * `name`: The service account name. > * `permission`: For restricted accounts, the access level: `READ_PERMISSION`, > `WRITE_PERMISSION`, or `READWRITE_PERMISSION`. Omitted for unrestricted > accounts. > * `labels`: For restricted accounts, the key-value label pair restrictions. > > The command doesn't return the account email or creator. The default `table` > output shows only the `id`, `slug`, and `name` fields. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`ListServiceAccounts`](/tooling/api-info/definition/operations/ListServiceAccounts) endpoint. > > The endpoint returns the following fields for each service account: > > * `slug`: The unique identifier for the service account. > * `name`: The service account name. > * `email`: The unique email user for this service account. Read-only. > * `created_at`: When the service account was created. > * `updated_at`: When the service account was last modified. > * `unrestricted`: Whether the account has full access to the Cortex XCOR API. > * `metrics_restriction`: For restricted accounts, the metric access > restriction. Contains a `permission` level of `READ`, `WRITE`, or > `READ_WRITE`, and optional `labels` that limit access to metrics with > matching label names and values. > > The `token` field is returned only in the `CreateServiceAccount` response, so > it's empty in list results. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. If you have a service account token, and don't know which account it belongs to, use the following Chronoctl command: ```shell theme={null} chronoctl auth whoami --api-token=TOKEN ``` Replace *`TOKEN`* with your service account token. ## Create a service account New service accounts can be one of the following types, each configured differently: * An *unrestricted service account*, which grants full access to all Cortex XCOR APIs and entities, including administration and monitoring features. * A *restricted service account*, which grants certain permissions to access only telemetry data, and optionally limiting displayed metrics to those with one or a pair of specific, case-sensitive label names and values. To use a service account with Chronoctl or Terraform, you must create an unrestricted service account. To use a service account with the Chronosphere Collector, create a restricted write-only service account. ### Create an unrestricted service account A service account can access the entire Cortex XCOR API, but this access doesn't necessarily grant it all possible privileges. You can also assign the `SysAdmin` role to the team that the service account belongs to, but doing so is required only if the service account needs to create, modify, and delete accounts, teams, and [certain resources](/administer/accounts-teams/teams#assign-team-roles-and-permissions). To make an unrestricted service account read-only, remove it from the **Default** team and any other team that grants the `Editor` or `SysAdmin` role. The account retains read-only access to the Cortex XCOR API. For more information, see [Assign team roles and permissions](/administer/accounts-teams/teams#assign-team-roles-and-permissions). > [!NOTE] > > You **must** be a member of a team with the `SysAdmin` role to create a new service > account. Select from the following methods to create an unrestricted service account. > [tab] Web > > To create an unrestricted service account: > > 1. In the navigation menu, click ** Go to admin view** > and then select > **Platform > Service Accounts**. > 2. Click **+ Service Account**. This opens the **Add Service Account** dialog. > 3. In the **Service Account Name** field, enter a descriptive name for the service > account. > 4. In the **Service Account Type** section, select **Unrestricted**. > 5. Click **Save**. > > After creating the service account, Cortex XCOR displays its secret token. > > > [!WARNING] > > > > This is the only time Cortex XCOR displays the service account's token. > > Store it securely. If you lose the token, you must delete and recreate the service > > account to generate a new token. > [tab] Chronoctl > > To create and manage service accounts with [Chronoctl](/tooling/chronoctl), > the account you use must either be a member of a team with the > [`SysAdmin` role](/administer/accounts-teams/user-accounts#grant-system-administrator-sysadmin-privileges-to-users) > or an unrestricted service account. > > 1. Generate a templated service account resource with the > `chronoctl service-accounts scaffold` command: > > ```shell theme={null} > chronoctl service-accounts scaffold > service-account.yml > ``` > > Replace `service-account.yml` with any valid filename. > > 2. Edit the generated template to configure the new service account. Remove > any fields that you don't need to configure. > > For example, to configure an unrestricted service account with the > slug `ci-build-account` and name `CI Build Account`, > the resulting resource is: > > ```yaml service-account.yml icon="square-terminal" theme={null} > api_version: v1/config > kind: ServiceAccount > spec: > slug: ci-build-account > name: CI Build Account > unrestricted: true > ``` > > 3. Create the resource by passing the file containing the resource to the > `service-accounts create` command. > > ```shell theme={null} > chronoctl service-accounts create -f service-account.yml > ``` > > The command returns the service account resource, including its secret API > `token`: > > ```yaml Service account resource icon="square-terminal" theme={null} > api_version: v1/config > kind: ServiceAccount > spec: > slug: ci-build-account > name: CI Build Account > token: acc261.... > email: 7da....@serviceaccount.chronosphere.io > unrestricted: true > ``` > > > [!WARNING] > > > > This is the only time Cortex XCOR displays the service account's token. > > Store it securely. If you lose the token, you must delete and recreate the service > > account to generate a new token. > [tab] Terraform > > To create an unrestricted service account with [Terraform](/tooling/infrastructure/terraform), > use the `chronosphere_service_account` resource type and assign a `name` to use > in Cortex XCOR inside the resource declaration. > > For example, this code creates a service account without any restrictions that > Terraform refers to as `all_access`: > > ```terraform Terraform example icon="square-terminal" theme={null} > resource "chronosphere_service_account" "all_access" { > name = "Terraform - Unrestricted" > } > ``` > > 1. Add the definition to a Terraform file. > 2. Run this command to create the resource: > > ```shell theme={null} > terraform apply > ``` > > Terraform stores the new service account's secret token in its state. To use the > token in other Terraform resources, use the `.token` field of the service account > resource. > > Using the previous example, the token for the service account with the Terraform > resource name `all_access` is accessible at `chronosphere_service_account.all_access.token`. > > To view the token, inspect your Terraform state file. For example, you can use the > [`jq`](https://stedolan.github.io/jq/) tool to filter service accounts in the state > file: > > ```shell theme={null} > jq '.resources[] | select(.type=="chronosphere_service_account")' terraform.tfstate > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`CreateServiceAccount`](/tooling/api-info/definition/operations/CreateServiceAccount) endpoint > and update the `service_account.unrestricted` key. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ### Create a restricted service account A restricted service account can access *only* the telemetry ingest and query APIs. The account can't access any of the other APIs. It can't make configuration changes, such as adding rules, creating monitors, or adding accounts. You can also optionally define **Label Restrictions** on restricted accounts to limit the account to querying or ingesting only specific labels or label-value pairs when authenticating with the account's token. The following types of restricted service accounts are available: * **Read-only** accounts are permitted only to query data. If you also define Label Restrictions, the account can query only metrics with the defined metric label keys or key-value pairs. * **Write-only** accounts are permitted only to ingest data. If you also define Label Restrictions, the account can ingest only metrics with the defined metric label keys or key-value pairs. * **Read & write** accounts are permitted to both query and ingest data, following any defined Label Restrictions. Write-only accounts are based on the principle of least privilege. A robot whose only job is to send ingest data to the server doesn't need query access. Restricted, read-only service accounts are restricted to reading even if the service account is added to a team with `Editor` or `SysAdmin` roles. Restricted accounts using label restrictions force a label with a specific value to be present on write, and allows queries that include only that label-value pair. Label restrictions support a maximum of two key-value pairs. Key-value pairs on individual service accounts must be unique. You can't set multiple values for the same label key. > [!NOTE] > > Cortex XCOR strips this label from query responses. Users with > a restricted service account aren't aware that they're viewing metrics > that match only the specified label. > > Users see all other telemetry. Select from the following methods to create a restricted service account. > [tab] Web > > To create a restricted service account, you must have administrative privileges. > > 1. In the navigation menu, click ** Go to admin view** and then select > **Platform > Service Accounts**. > 2. Click **+ Service Account**. This opens the **Add Service Account** dialog. > 3. In the **Service Account Name** field, enter a descriptive name for the > service account. > 4. In the **Service Account Type** section, select **Restricted**. Cortex XCOR displays > additional fields for you to complete. > 5. Complete the creation process based on your needs. Use the > **Label Restrictions** section to limit this account's metrics access to only > labels with one, or a pair of specific key-value pairs. Click **+Add Label** > to add a second key-value pair. Label restrictions are case sensitive. > 6. Click **Save**. > > After creating the service account, Cortex XCOR displays its secret token. > > > [!WARNING] > > > > This is the only time Cortex XCOR displays the service account's token. > > Store it securely. If you lose the token, you must delete and recreate the service > > account to generate a new token. > [tab] Chronoctl > > To create a restricted service account with [Chronoctl](/tooling/chronoctl), use the > `service-accounts create` command. > > Specify required values as command arguments: > > * name (`--name`) > * permission (`--permission`). Valid `permission` values are: > * `READ`: Read-only access. > * `WRITE`: Write access. > * `READ_WRITE`: Read and write access. > > You can also specify optional metric label arguments: > > * label name (`--label-name`) > > * label value (`--label-value`) > > 1. Generate a templated service account resource with the `service-accounts scaffold` > command: > > ```shell theme={null} > chronoctl service-accounts scaffold > service-account.yaml > ``` > > Replace `service-account.yaml` with any valid filename. > > 2. Edit the generated template to configure the new service account. Remove any > fields that you don't need to configure. > > For example, to configure a restricted service account that can read and write > only metrics with the label `tenant` and the value `name`, the resulting resource > is: > > ```yaml service-account.yaml icon="square-terminal" theme={null} > api_version: v1/config > kind: ServiceAccount > spec: > slug: tenant-name > name: tenant > metrics_restriction: > labels: > tenant: name > permission: READ_WRITE > ``` > > 3. Create the service account: > > ```shell theme={null} > chronoctl service-accounts create -f service-account.yml > ``` > > The command returns the service account resource, including its secret API > `token`: > > ```yaml Service account resource icon="square-terminal" theme={null} > api_version: v1/config > kind: ServiceAccount > spec: > slug: tenant-name > name: tenant > metrics_restriction: > labels: > tenant: name > token: acc261.... > email: 7da....@serviceaccount.chronosphere.io > ``` > > > [!WARNING] > > > > This is the only time Cortex XCOR displays the service account's token. > > Store it securely. If you lose the token, you must delete and recreate the service > > account to generate a new token. > [tab] Terraform > > To create a restricted service account using > [Terraform](/tooling/infrastructure/terraform), use the > `chronosphere_service_account` resource type followed by a resource name, and include > a `restriction` section in the resource declaration. > > You must add a `permission` value in the `restriction` section to define the > account's access. Valid `permission` values are: > > * `READ`: Read-only access. > * `WRITE`: Write access. > * `READ_AND_WRITE`: Read and write access. > > You can optionally add a `labels` value in the `restriction` section to additionally > restrict the service account's access to limit metrics to display only those that > have the specified label name and value. > > For example, this code creates a restricted service account that Terraform refers to > as `restricted_labeled`, which can only read and write metrics with the label name > `tenant` and label value `name`: > > ```terraform Terraform example icon="square-terminal" theme={null} > resource "chronosphere_service_account" "restricted_labeled" { > name = "Terraform - Restricted, READ_AND_WRITE, labeled" > restriction { > permission = "READ_AND_WRITE" > labels = { "tenant" : "name" } > } > } > ``` > > 1. Add the definition to a Terraform file. > 2. Run this command to create the resource: > > ```shell theme={null} > terraform apply > ``` > > Terraform stores the new service account's secret token in its state. To use the > token in other Terraform resources, use the `.token` field of the service account > resource. > > Using the previous example, the token for the service account with the Terraform > resource name `all_access` is accessible at `chronosphere_service_account.all_access.token`. > > To view the token, inspect your Terraform state file. For example, you can use the > [`jq`](https://stedolan.github.io/jq/) tool to filter service accounts in the state > file: > > ```shell theme={null} > jq '.resources[] | select(.type=="chronosphere_service_account")' terraform.tfstate > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`CreateServiceAccount`](/tooling/api-info/definition/operations/CreateServiceAccount) endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. #### Label restriction example Label restrictions support a third-party use case, where Cortex XCOR is the first party, and a Cortex XCOR customer (CompanyX) is the second party. A Cortex XCOR customer's customer (CompanyA, CompanyB, or CompanyC) is the third party. In this scenario, CompanyX uses one tenant with Cortex XCOR to store data about CompanyA, CompanyB, and CompanyC, discriminated by some key (such as `third-party`) with a value of `A`, `B`, or `C`. Employees of CompanyX can see all of the data. Employees of CompanyA get a restricted service account with a label restriction of `third-party=A`. CompanyA doesn't know this key or this value. Whenever they send data to Cortex XCOR, Cortex XCOR augments the writes with `third-party=A`. Whenever CompanyA does queries, Cortex XCOR lets them see time series that include only `third-party=A`, but Cortex XCOR strips this label before showing the time series to employees of CompanyA. ## Delete a service account Select from the following methods to delete a service account. > [!NOTE] > > Users can modify Terraform-managed resources only by using Terraform. > [Learn more](/tooling/infrastructure/terraform#prevent-changes-to-managed-resources). > [tab] Web > > To delete a service account, you must have administrative privileges. > > 1. In the navigation menu, click ** Go to admin view** and then select > **Platform > Service Accounts**. > 2. Select the checkboxes for one or more service accounts you want to delete. > 3. Click ** Delete** at the top of the list of service > accounts. > [tab] Chronoctl > > To delete a service account with [Chronoctl](/tooling/chronoctl), the account you use must > either be a member of a team with the > [`SysAdmin` role](/administer/accounts-teams/user-accounts#grant-system-administrator-sysadmin-privileges-to-users), > or > an unrestricted service account. > > Use the `service-accounts delete` command, passing the account's slug as the `--slug` > argument. > > For example, to delete a service account with the slug `tenant-name`: > > ```shell theme={null} > chronoctl service-accounts delete tenant-name > ``` > [tab] Terraform > > To delete a resource that's managed by [Terraform](/tooling/infrastructure/terraform): > > 1. Edit your Terraform configuration file to remove the pre-existing resource > definition. > 2. Run this command to remove the resource from Cortex XCOR: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`DeleteServiceAccount`](/tooling/api-info/definition/operations/DeleteServiceAccount) endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. # Teams Source: https://docs-xcor.paloaltonetworks.com/administer/accounts-teams/teams Palo Alto Networks Cortex XCOR lets you create and manage teams, assign roles, and set permissions for effective collaboration. A *team* defines how an organization grants permissions for sensitive management and administrative operations to *accounts*, including [*user accounts*](/administer/accounts-teams/user-accounts) and [*service accounts*](/administer/accounts-teams/service-accounts). A team's accounts have a shared responsibility for certain services. Palo Alto Networks Cortex XCOR represents those services as [*collections*](/administer/collections), which contain resources related to the service a collection represents, such as dashboards and monitors. A team can own multiple collections. All user and service accounts in a team that has the special System Administrator (`SysAdmin`) role are *administrators*. If you're an administrator, you can [add this role to a team](#add-a-role-to-a-team). Teams can own collections and services, which in turn own other functions: ```mermaid actions={false} theme={null} flowchart TD accDescr: Ownership flow for teams and functions Team[**Team**] Col(Collections) Ser(Services ) Team --> Col Team --> Ser Dash(Dashboards) Mon(Monitors) SLO(SLOs) Col --> Dash Col --> Mon Col --> SLO Dash2(Dashboards) Mon2(Monitors) SLO2(SLOs) Ser --> Dash2 Ser --> Mon2 Ser --> SLO2 ``` ## View teams To search for a team: 1. Click the search bar to focus on it, or use the keyboard shortcut `Control+K` (`Command+K` on macOS). 2. Begin typing any part of the team's name. 3. Optional: Click the **Teams** filter at the top of the search results to constrain your results to only Teams. 4. Click the search result you're interested in, or use the arrow keys to select it and press enter, to go to that team. ### View teams and their collections To view teams and the collections they own, in the navigation menu click ** Go to admin view**, and then select **Platform > Collections** or **Platform > Teams**. For details about working with collections, see [Collections](/administer/collections). ### View a list of teams to manage To view teams in a list that displays their members, provides an audit log of membership changes, and includes management options for administrators: > [tab] Web > > In the navigation menu, click ** Go to admin view** and then select > **Platform > Teams**. > [tab] Chronoctl > > Use the command: > > ```shell theme={null} > chronoctl teams list > ``` For details, see [Accounts and Teams](/administer/accounts-teams#view-accounts-and-teams). ## Manage teams > [!NOTE] > > To manage teams, you must use a user account or > [service account](/administer/accounts-teams/service-accounts) that belongs to a team > with the SysAdmin role. To manage teams, in the navigation menu, click ** Go to admin view** and then select **Platform > Teams**. ### Create a team > [tab] Web > > To create a new team: > > 1. In the navigation menu, click ** Go to admin view** > and then select > **Platform > Teams**. > 2. Click **Create team**. > 3. In the dialog that appears, enter a name for the new team and the access role it > should have. > 4. Click **Save** to create the team. > > The team now appears in the list of users and teams. > [tab] Chronoctl > > > [!WARNING] > > > > To create teams or modify team membership with Chronoctl, you must use a user account > > or [service account](/administer/accounts-teams/service-accounts) that > > belongs to a team with the SysAdmin role. > > To create and manage a team with [Chronoctl](/tooling/chronoctl), > use the `Team` resource type. The resource can contain these fields: > > | Field | Type | Description | > | - | - | - | > | `name` | String | The team name as displayed in Cortex XCOR. | > | `slug` | String | Optional: A unique identifier that Cortex XCOR uses to identify the team. If omitted, Cortex XCOR generates a slug. | > | `description` | String | Optional: A description displayed when viewing this team. | > | `user_emails` | Collection of strings | Contains an item for each member account's email address. | > > To generate an example Team resource, run `chronoctl teams scaffold`. > > If an email address in `users` doesn't already have a Cortex XCOR > account, the app creates a pending user account for that email address. When that > user signs in, Cortex XCOR then activates the account. > > For example, this YAML resource creates a team named `DBAs` in Cortex XCOR, with the > description `Database administrators`, and which the app > identifies with the slug `dbas`. It also includes the listed accounts identified by > their email addresses as team members: > > ```yaml Chronoctl example icon="square-terminal" theme={null} > api_version: v1/config > kind: Team > spec: > name: DBAs > slug: dbas > description: "Database administrators" > user_emails: > - adam@example.com > - betty@example.com > ``` > > To include service accounts, add the service account's internal email address to > the `users` list. For details, see [Service Accounts](/administer/accounts-teams/service-accounts). > [tab] Terraform > > > [!WARNING] > > > > To create teams or modify team membership with Terraform, you must use a user account > > or [service account](/administer/accounts-teams/service-accounts) that > > belongs to a team with the SysAdmin role. > > To create and manage a team with [Terraform](/tooling/infrastructure/terraform), > declare the `chronosphere_team` resource type and provide a resource name. The resource > can contain these fields: > > | Field | Type | Description | > | - | - | - | > | `name` | String | The team name as displayed in Cortex XCOR. | > | `slug` | String | Optional: A unique identifier that Cortex XCOR uses to identify the team. If omitted, Cortex XCOR generates a slug. | > | `description` | String | Optional: A description displayed when viewing this team. | > | `user_emails` | Array of strings | The email address for each member account. | > > For example, this resource creates a team referred to by Terraform as `dbas`, named > `DBAs` in Cortex XCOR, and identified in the app with the slug `dbas`. It > also includes the listed accounts identified by their email addresses as team > members: > > ```terraform Terraform example icon="square-terminal" theme={null} > resource "chronosphere_team" "dbas" { > name = "DBAs" > slug = "dbas" > description = "Database administrators" > > user_emails = [ > "adam@example.com", > "betty@example.com", > ] > } > ``` > > To include service accounts, add the service account's internal email address to > the `user_emails` array. For details, see [Service Accounts](/administer/accounts-teams/service-accounts). > > 1. Add the definition to a Terraform file. > 2. Run this command to create the resource: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`CreateTeam`](/tooling/api-info/definition/operations/CreateTeam) endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ### Edit team membership > [tab] Web > > To add users to or remove users from a team: > > 1. In the navigation menu, click ** Go to admin view** and then select > **Platform > Teams**. > 2. [Select the team](/administer/accounts-teams#view-accounts-and-teams) to manage. > 3. Click ** Edit Team**. > 4. In the **Team Members** section, click **Update Membership**. > 5. From the account list that appears, select the checkbox for each account you want > to add to the team, and clear the checkbox for each account you want to remove > from the team. > 6. Click **Save** to edit the team's membership. > > The team page updates its membership list accordingly, and the audit log adds an > entry logging the operation. > > The account list includes both user and service accounts. You can remove a service account > from the **Default** team to make it read-only. For more information, see > [Assign team roles and permissions](#assign-team-roles-and-permissions). > [tab] Chronoctl > > > [!WARNING] > > > > To modify teams with Chronoctl, you must use a user account or > > [service account](/administer/accounts-teams/service-accounts) that > > belongs to a team with the `SysAdmin` role. > > You can use [Chronoctl](/tooling/chronoctl) to replace and update a team and > its membership with those defined in a YAML file. > > To generate a YAML description of your current teams and accounts, see > [View Accounts and Teams](/administer/accounts-teams#view-accounts-and-teams). > > Following the `DBAs` team example from [creating a team](#create-a-team), > to add a user to that team, update the YAML to include the new user's email: > > ```yaml Chronoctl example icon="square-terminal" theme={null} > api_version: v1/config > kind: Team > spec: > name: DBAs > slug: dbas > description: "Database administrators" > user_emails: > - adam@example.com > - betty@example.com > - charles@example.com > ``` > > To apply the changes, use the Chronoctl `chronoctl teams update` command, which > updates teams but doesn't create them if they don't already exist: > > ```shell /FILE_NAME/ theme={null} > chronoctl teams update -f FILE_NAME.yaml > ``` > > Replace *`FILE_NAME`* with the path to the YAML definition file. > > You can test the changes without applying them by including the `--dry-run` flag: > > ```shell /FILE_NAME/ theme={null} > chronoctl teams update -f FILE_NAME.yaml --dry-run > ``` > > To force `teams update` to create a defined team if it doesn't exist, include the > `--create-if-missing` flag: > > ```shell /FILE_NAME/ theme={null} > chronoctl teams update -f FILE_NAME.yaml --create-if-missing > ``` > [tab] Terraform > > To edit a team's membership using [Terraform](/tooling/infrastructure/terraform), modify the > `user_emails` array in the team's `chronosphere_team` resource, and then apply the > resource using Terraform. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateTeam`](/tooling/api-info/definition/operations/UpdateTeam) endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Assign team roles and permissions Cortex XCOR teams use *roles* to grant or restrict access to features that create, edit, or delete resources, teams, and accounts. Roles are assigned to teams, and all accounts that belong to a team gain the permissions granted by that team's role. ### Default team properties During creation, accounts are assigned to the **Default** team, which has the `Editor` role. The **Default** team can't be deleted, and its role can't be changed. To remove editing access from a user or service account, [remove them from the **Default** team](#edit-team-membership). This limits the account to read-only Viewer access if they don't have edit access through membership in another team. [Unrestricted service accounts](/administer/accounts-teams/service-accounts#create-an-unrestricted-service-account) removed from the **Default** team have read-only access to the full Cortex XCOR API. To create a read-only unrestricted service account that can access all APIs, remove it from the **Default** team. ### Available roles The available roles are: * `None`: Accounts on teams with this role can view pages in Cortex XCOR but can't create, edit, or remove resources or accounts. Any [Operator](/navigate/operator) chats by these accounts aren't saved to the chat history. Accounts that don't belong to any team also have the `None` role by default. * `Editor`: Accounts on teams with this role can create, view, edit, and delete resources within Cortex XCOR, but can't create, edit, or delete accounts and teams. Operator saves the last 20 chat sessions of accounts that have the `Editor` or higher roles. * `SysAdmin`: Any account that's a member of a team with the System Administrator (`SysAdmin`) role can create, edit, and delete accounts and teams, assign accounts to teams, and assign roles to teams. Accounts with this role are designated by a key icon next to their name in the **Users** list. * `User Administrator`: Accounts belonging to teams with this role can access the System for Cross-domain Identity Management (SCIM) API, which manages accounts that use single sign-on. This role grants no other permissions. The `User Administrator` role can be assigned to teams only in organizations that have SCIM integration enabled. For more information, see [Okta user synchronization](/administer/accounts-teams/okta). If an account belongs to multiple teams with different roles, they inherit the highest-level permissions of each assigned team. For example, an account in a team with the `Editor` role and a second team with the `SysAdmin` role has both sets of privileges. The following chart summarizes roles and permissions: | Action | None | Editor | SysAdmin | User Admin | | - | :-: | :-: | :-: | :-: | | Interact with SCIM API | | | | | | View pages in Cortex XCOR | | | | | | Add and edit user and service accounts | | | | | | Add, edit, and remove teams | | | | | | Change users' team membership | | | | | | Apply service configuration changes | | | | | | Add, edit, and remove Trace Optimization datasets | | | | | | Add, edit, and remove derived labels | | | | | | Add, edit, and remove other resources | | | | | Some features vary by role beyond whether an account can use them. Accounts with the `None` role can chat with [Operator](/navigate/operator), but their conversations aren't saved, don't appear in chat history, and can't be shared. See [Availability and permissions](/navigate/operator#availability-and-permissions). ### Add a role to a team To add a role to a team: 1. In the navigation menu, click ** Go to admin view** and then select **Platform > Teams**. 2. [Select the team](/administer/accounts-teams#view-accounts-and-teams) to manage. 3. In the **Team Information** section, click ** Edit**. 4. Click the **Role** dropdown and select the role you want to assign to the team. 5. Click **Save**. ### Remove a role from a team To remove a role from a team: 1. In the navigation menu, click ** Go to admin view** and then select **Platform > Teams**. 2. [Select the team](/administer/accounts-teams#view-accounts-and-teams) to manage. 3. In the **Team Information** section, click ** Edit**. 4. Click the **Role** dropdown and select the **None** role. 5. Click **Save**. ### Rename a team To rename a team: 1. In the navigation menu, click ** Go to admin view** and then select **Platform > Teams**. 2. [Select the team](/administer/accounts-teams#view-accounts-and-teams) to manage. 3. In the **Team Information** section, click ** Edit**. 4. Change the team's name in the **Name** field. 5. Click **Save**. ### Describe a team Team pages can display a brief description in the **Team Information** section. You can use this description to clarify the team's purpose, identify the people responsible for managing it, or provide general information or context to the team's activities. You can also add links to URLs, whether within or external to Cortex XCOR, to the **Team Information** section. To access a team's information: 1. In the navigation menu, click ** Go to admin view** and then select **Platform > Teams**. 2. [Select the team](/administer/accounts-teams#view-accounts-and-teams) to manage. 3. In the **Team Information** section, click ** Edit**. To add, edit, or remove a team's description: 1. Enter the team description in the **Description** field. 2. Click **Save**. To add links to a team's information: 1. In the **Team Links** section, click ** Add**. This adds a row of fields to the section. 2. Enter the link text in the **Link Name** field. 3. Enter the link target in the **URL** field. 4. Repeat these steps to add more links. 5. Click **Save**. To edit a team's links: 1. In the **Team Links** section, modify the link's **Link Name** and **URL** fields. 2. Click **Save**. To remove links from a team's information: 1. In the **Team Links** section, click the delete button in the rows of the links you want to delete. 2. Click **Save**. ### Delete a team Use one of the following methods to delete a team. The **Default** team can't be deleted. > [tab] Web > > To delete a team: > > 1. In the navigation menu, click ** Go to admin view** and > then select **Platform > Teams**. > 2. [Select the team](/administer/accounts-teams#view-accounts-and-teams) to delete. > 3. In the **Team Information** section, click ** Edit**. > 4. Click **Delete team**. > 5. In the confirmation dialog that appears, click **Delete**. > [tab] Chronoctl > > To delete teams with [Chronoctl](/tooling/chronoctl), use the `chronoctl teams delete` > command: > > ```shell /SLUG/ theme={null} > chronoctl teams delete SLUG > ``` > > Replace *`SLUG`* with the unique slug of the team you want to delete. > > For example, to delete the team with the slug `dbas`, run: > > ```shell theme={null} > chronoctl teams delete dbas > ``` > [tab] Terraform > > To delete a resource that's managed by [Terraform](/tooling/infrastructure/terraform): > > 1. Edit your Terraform configuration file to remove the pre-existing resource > definition. > 2. Run this command to remove the resource from Cortex XCOR: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`DeleteTeam`](/tooling/api-info/definition/operations/DeleteTeam) endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. # User accounts Source: https://docs-xcor.paloaltonetworks.com/administer/accounts-teams/user-accounts Palo Alto Networks Cortex XCOR lets you manage user access by handling account creation, modification, and role assignments. A *user account* represents a user's identity in Palo Alto Networks Cortex XCOR. Accounts can belong to [*teams*](/administer/accounts-teams/teams), which group and distribute permissions to its members. ## Grant System Administrator (`SysAdmin`) privileges to users You can grant permissions to teams, which then confer those permissions to its users. A user account that's a member of a team with the `SysAdmin` role has administrative access to Cortex XCOR features. This includes the abilities to create teams and user accounts, assign users to teams, and define team permissions. For instructions about assigning roles to a team, see [Add a role to a team](/administer/accounts-teams/teams#add-a-role-to-a-team). ## Authenticating as a user To [authenticate](/overview/authenticating) with Cortex XCOR, a user typically signs in interactively with their user account. A user account can also use a temporary [personal access token](/administer/accounts-teams/personal-access-tokens) for non-interactive authentication, such as with tools like Chronoctl or for clients that interact with the Cortex XCOR API. Cortex XCOR attributes all actions that a user takes to their user account. > [!NOTE] > > User accounts are distinct from *service accounts*, which provide identities for > services and allow administrators to define what each service can access. Service > accounts authenticate non-interactively using a unique API token permanently associated > with each account. > > For details, refer to [Service accounts](/administer/accounts-teams/service-accounts). ## View accounts You can view accounts in the navigation menu, or by using Chronoctl. In the navigation menu, click ** Go to admin view** and then select **Platform > Users**. For details, see [Accounts and teams](/administer/accounts-teams#view-accounts-and-teams). ## Add a user account > [!NOTE] > > To add user accounts, you must use an account that belongs to a team with the > `SysAdmin` role. > > This process applies only to accounts *without* single sign-on enabled. For details, > see [Authenticating with Cortex XCOR](/overview/authenticating). To add a user account, you must have administrative privileges: 1. In the navigation menu, click ** Go to admin view** and then select **Platform > Users**. 2. Click ** Add user**. 3. Enter the user's email address into the field. 4. Click **Invite User**. 5. Optional: Add the user to a [team](/administer/accounts-teams/teams). Users without an assigned team receive viewer permissions. Cortex XCOR sends an invitation email to the address containing a link to verify and access the user account. After the user accepts the invitation, they must verify their account, at which point the user's email address appears in the list of accounts with a green checkmark. ## Delete a user account To remove a user account from Cortex XCOR: 1. If your environment uses a single sign-on (SSO) provider, remove the user account from the identity provider (IdP) permission group to prevent the user from signing in to Cortex XCOR. 2. To remove the user account from display in Cortex XCOR itself, create a ticket with Cortex XCOR Support and request to have the user account deleted. ### Users of Okta with SCIM If you're using Okta and have SCIM integrated with the Cortex XCOR connection, removing the user from access in the IdP deprovisions and removes the user from Cortex XCOR. ### Service accounts > [!WARNING] > > Ensure a service account isn't being used before you delete it. Service account > tokens are used by critical components of Cortex XCOR (including the > Chronosphere Collector), and incorrectly deleting a service account can significantly > impact your environment. Deleted user accounts with access to a service account token can continue to access Cortex XCOR when using tools like Chronoctl and Terraform. To avoid access by these accounts, delete any service accounts created by deleted user accounts. To find these accounts, in the navigation menu, click ** Go to admin view** and then select **Platform > Service Accounts** and review the **Created By** column. # Audit logs Source: https://docs-xcor.paloaltonetworks.com/administer/audit-logs View recent system and user actions in the Audit Log, including event details and the accounts and apps that generated them. To view recent system and user actions, view the Audit Log, which is available to users with administrative privileges. In the navigation menu, click ** Go to admin view** and then select **Platform > Audit logs**. Click one of the listed actions or events to view its details, including the following: * Description of the event. * Date and time of the event. * Service account ID of the user who performed the event. * App that generated the event. * App method that generated the event * Method resource that generated the event. * Full JSON payload of the event. # Collections Source: https://docs-xcor.paloaltonetworks.com/administer/collections Learn how collections group dashboards, monitors, and other resources so a team can manage a service at scale. A *collection* is a group of Palo Alto Networks Cortex XCOR resources, such as [dashboards](/observe/dashboards) and [monitors](/investigate/alerts/monitors), associated with a service or feature you want to monitor. A [*team*](/administer/accounts-teams/teams), consisting of [*user accounts*](/administer/accounts-teams/user-accounts) and [*service accounts*](/administer/accounts-teams/service-accounts) that share responsibility for the service or feature, is also responsible for each collection. Collections help service and feature owners manage their services at scale and streamline incident response by consolidating all relevant information about a service or feature into one place, and sharing access to that information with everyone in its responsible team. For example, to ensure that your team and on-call engineers all have full context for a service, you can create a collection for it that provides direct access to its monitors, dashboards, and the team members who can respond to incidents. Cortex XCOR then provides a menu of a team's collections to its members who can quickly review resources most relevant to their services, and a homepage for the collection that the team can share with on-call engineers or other stakeholders. ## View collections > [tab] Web > > To search for a collection: > > 1. Click the search bar to focus on it, or use the keyboard shortcut > `Control+K` (`Command+K` on macOS). > 1. Begin typing any part of the collection's name. > 2. Optional: Click the filters for all other listed resource types at the top of > the search results to remove them and display only collections. > 3. Click the search result you're interested in, or use the arrow keys to select > it and press `Enter` (`Return` on macOS), to select that > collection. > > An *unowned collection* is a collection that isn't assigned to a team. Unowned > collections often originate from *buckets*, an earlier container for organizing > resources that Cortex XCOR automatically converted to unowned > collections. To resolve an unowned collection, > [assign it to a team](#edit-a-collection). > > To browse collections in a filterable table: > > 1. In the navigation menu, click ** Go to admin view** and > then select > **Platform > Collections**. > Clicking a collection or team in this table takes you to their respective > homepages. > > * To filter this table by keyword, click **Search collections** and begin typing. > The table automatically updates to display only the matching collections. > * To filter this list by teams, select them in the **Select a Team** dropdown. > * To display only collections that lack an owner, enable the **Unowned Collections Only** > toggle. > > You can optionally select collections by checking the checkbox on each collection's > row, which reveals an **Edit Team Association** button. Clicking this button allows > you to select a parent team for all selected collections. If you select a team, > click **Save** to save the edited association. For more Collection editing features, > see [Edit a Collection](#edit-a-collection). > [tab] Chronoctl > > To view a list of all collections using [Chronoctl](/tooling/chronoctl), use the > `collections list` command: > > ```shell theme={null} > chronoctl collections list > ``` > > This returns a list of YAML documents separated by three dashes (`---`), each > representing a collection: > > ```yaml Chronoctl example icon="square-terminal" theme={null} > api_version: v1/config > kind: Collection > spec: > slug: example-collection > name: Example Collection > team_slug: example-team > description: Example Team - Example Collection > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`ListCollections`](/tooling/api-info/definition/operations/ListCollections) endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Create a collection You can use Cortex XCOR to create Terraform, Chronoctl, or API configurations, which you must then apply using the respective application. Collections use a `slug` as an identifier. [Services](/observe/services) also use a `slug`. Collection and service slugs can have the same value. > [tab] Web > > To create a collection, you must have administrative privileges. > > 1. In the navigation menu, click ** Go to admin view** > and then click > **Platform > Collections**. > 2. Click **Create collection**. > 3. In the dialog that appears, enter a descriptive name in the **Collection Name** > field. Cortex XCOR displays this name anywhere that it refers to this > collection. > 4. Optional: Click the **Parent team** dropdown and select a team to which > you're associating this collection. If the dropdown doesn't contain any teams, > you can create one. > 5. Optional: Enter a description in the **Collection Description** field. > Cortex XCOR displays this description when you view this collection's > homepage. > 6. Click **Save**. > [tab] Chronoctl > > To create a collection using [Chronoctl](/tooling/chronoctl), apply a `Collection` resource. > The resource contains these fields: > > | Field | Type | Description | > | - | - | - | > | `name` | String | The collection name as displayed in Cortex XCOR. | > | `slug` | String | Optional: A unique identifier that Cortex XCOR uses to identify the collection. If omitted, Cortex XCOR generates a slug. | > | `team_slug` | String | Optional: The slug of the team with which you're associating with this collection. | > | `description` | String | A description displayed when viewing this collection. | > | `notification_policy_slug` | String | The slug of a notification policy that you're associating with this collection. | > > For example, this resource creates a new collection named `DBAs` with the slug > `dbas-collection` and associated with `dbas-team`: > > ```yaml Chronoctl example icon="square-terminal" theme={null} > api_version: v1/config > kind: Collection > spec: > slug: dbas-collection > name: DBAs > team_slug: dbas-team > description: Collection of database-related resources. > notification_policy_slug: dbas-policy > ``` > > To create the collection: > > 1. Save the `Collection` resource definition to a file, such as `collection.yaml`. > > 2. Test the changes with a dry run: > > ```shell theme={null} > chronoctl collections create -f collection.yaml -d > ``` > > 3. Apply the changes: > > ```shell theme={null} > chronoctl collections create -f collection.yaml > ``` > [tab] Terraform > > To create a collection using [Terraform](/tooling/infrastructure/terraform), use > the `chronosphere_collection` resource type. > > | Field | Type | Description | > | - | - | - | > | `name` | String | The collection name as displayed in Cortex XCOR. | > | `slug` | String | Optional: A unique identifier that Cortex XCOR uses to identify the collection. If omitted, Cortex XCOR generates a slug. | > | `team_id` | String | Optional: The identifier of the team with which you're associating with this collection. | > | `description` | String | A description displayed when viewing this collection. | > | `notification_policy_id` | String | Optional: The identifier of a notification policy that you're associating with this collection. | > > For example, this resource creates a new collection that Terraform refers to as > `databases`, names it `Databases` in Cortex XCOR, provides a description, associates > the collection with a notification policy, and assigns the collection to the team `dbas`: > > ```terraform Terraform example icon="square-terminal" theme={null} > resource "chronosphere_collection" "infra" { > name = "Databases" > team_id = chronosphere_team.dbas.id > description = "Collection of resources related to database services." > notification_policy_id = chronosphere_notification_policy.np.id > } > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`CreateCollection`](/tooling/api-info/definition/operations/CreateCollection) endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Edit a collection > [tab] Web > > > [!NOTE] > > > > Users can modify Terraform-managed resources only by using Terraform. > > [Learn more](/tooling/infrastructure/terraform#prevent-changes-to-managed-resources). > > To edit a collection, you must have administrative privileges. > > 1. In the navigation menu, click ** Go to admin view** and > then select > **Platform > Collections**. > 2. Click the name of the collection you want to modify. > 3. In the **Collection information** section, click ** Edit**. > 4. In the dialog that appears, edit the collection based on your needs. > 5. Click **Save**. > > You can optionally select collections by checking the checkbox on each collection's > row, which reveals an **Edit Team Association** button. Clicking this button allows > you to select a parent team for all selected collections. If you select a team, > click **Save** to save the edited association. For more Collection editing features, > see [Edit a Collection](#edit-a-collection). > [tab] Chronoctl > > To edit a collection using [Chronoctl](/tooling/chronoctl), modify > an existing `Collection` resource, then apply the change. > > To view `Collection` resources as Chronoctl YAML, see > [View collections](#view-collections). > > 1. Copy the `Collection` resource for the collection you want to edit. > > 2. Save the collection to a file, such as `collection.yml`. > > 3. Modify the collection's fields. For details, see [Create a collection](#create-a-collection). > > 4. Test the changes with a dry run: > > ```shell theme={null} > chronoctl collections create -f collection.yaml -d > ``` > > 5. Apply the changes: > > ```shell theme={null} > chronoctl collections create -f collection.yaml > ``` > [tab] Terraform > > To edit a collection using [Terraform](/tooling/infrastructure/terraform), modify > its resource and apply it using Terraform. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateCollection`](/tooling/api-info/definition/operations/UpdateCollection) endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Delete a collection > [!WARNING] > > Before you delete a collection, you must first remove all of its monitors and dashboards. > You can do this by either deleting them or moving them to other collections. > [tab] Web > > > [!NOTE] > > > > Users can modify Terraform-managed resources only by using Terraform. > > [Learn more](/tooling/infrastructure/terraform#prevent-changes-to-managed-resources). > > To delete a collection, you must have administrative privileges. > > 1. In the navigation menu, click ** Go to admin view** and > then select > **Platform > Collections**. > 2. Click the name of the collection you want to delete. > 3. In the **Collection information** section, click ** Edit**. > 4. In the dialog that appears, click **Delete collection**. > [tab] Chronoctl > > > [!NOTE] > > > > Users can modify Terraform-managed resources only by using Terraform. > > [Learn more](/tooling/infrastructure/terraform#prevent-changes-to-managed-resources). > > To delete a collection using [Chronoctl](/tooling/chronoctl), use > the `collections delete` command: > > ```shell /SLUG/ theme={null} > chronoctl collections delete SLUG > ``` > > Replace *`SLUG`* with the slug for the collection you want to delete. > > For example, to delete a collection with the slug `dbas-collection`, run: > > ```shell theme={null} > chronoctl collections delete dbas-collection > ``` > [tab] Terraform > > To delete a resource that's managed by [Terraform](/tooling/infrastructure/terraform): > > 1. Edit your Terraform configuration file to remove the pre-existing resource > definition. > 2. Run this command to remove the resource from Cortex XCOR: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`DeleteCollection`](/tooling/api-info/definition/operations/DeleteCollection) endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. # Team and collection home pages Source: https://docs-xcor.paloaltonetworks.com/administer/collections/home View team and collection home pages to see associated monitors, alert statuses, dashboards, and context. Each [*team*](/administer/accounts-teams/teams) and [*collection*](/administer/collections) provides a *home* page that lists its associated resources. These pages provide an overview of alerting [monitors](/investigate/alerts/monitors) and their statuses, links to associated [dashboards](/observe/dashboards), and additional context about the team or collection. ## View a home page To go to a team's or collection's home page: 1. In the navigation menu, click ** Go to admin view**, and then select **Platform > Collections** or **Platform > Teams**. 2. Click a team or collection name to view its home page. You can also open a team or collection home page from [global search](/navigate/search). ### Alerting monitors The **Monitors** section includes a table that lists any [monitors](/investigate/alerts/monitors) associated with this team or collection that are reporting alerts. The table's columns provide pertinent details and links to each monitor: * **Status:** The table lists any monitors associated with the team or collection that have active alerts, sorted by descending severity from critical to warning levels. Monitors not reporting alerts, including fully muted monitors, aren't listed here. To view all monitors associated with this team or collection, click the section's **View all monitors** link. * **Name:** Each alerting monitor's name is a link to its **Monitor Info** view. * **Alerting For:** This indicates the duration since the monitor triggered the alert. * **Notification Policy:** When viewing a collection, each alerting monitor links to its [notification policy](/investigate/alerts/notifications/policies). * **Collection:** When viewing a team, each alerting monitor links to its associated collection home page. #### Create a monitor To create a monitor from a team's or collection's homepage, click the **+ Add** button in the homepage's Monitors section. This opens the **Add Monitor** panel. For more information, see [Create a monitor](/investigate/alerts/monitors#create-a-monitor). ### Dashboards The **Dashboards** section links to the first 10 dashboards associated with this team or collection in alphabetical order. To view all associated dashboards, click **View all dashboards**. Team home pages exclusively show links to each dashboard's associated collection. #### Create a dashboard To create a dashboard from a team's or collection's homepage, click the **+ Add** button in the homepage's Dashboards section. This opens the **Add Dashboard** modal. For more information, see [Create a dashboard](/observe/dashboards#create-a-new-dashboard). ### Notebooks The **Notebooks** section lists [notebooks](/navigate/notebooks) owned by the collection. Each row shows the notebook **Name** and **Date modified**, and each name links to the notebook in a full-screen view. When the collection has no notebooks yet, the section explains that the collection doesn't have any notebooks. To open the [notebooks list](/navigate/notebooks#view-the-notebooks-list), click **View all**. The list includes every notebook you can access, not only notebooks for this collection. For search and visibility steps on that list, see [Notebooks on a collection home page](/navigate/notebooks#notebooks-on-a-collection-home-page). To assign an existing notebook to this collection, open the notebook in a full-screen view, switch to **Editing** mode if needed, click ** Notebook settings**, and select the collection under **Collection**. See [Notebook ownership and sharing](/navigate/notebooks#notebook-ownership-and-sharing). ### Manage connected resources You can connect collections to monitors and dashboards which are owned by another collection or service. To connect a monitor or dashboard to a service from a collection's home page: 1. Next to **Monitors** or **Dashboards**, click **Manage**. 2. Select **Connections**. 3. Add or remove a [connected resource](/observe/services/extending-services#view-connected-resources). ### Collections Team home pages have a **Collections** section that links to each collection associated with the team, and includes text from the collection's description if available. #### Create a collection To create a collection from a team's homepage, click the **+ Add** button in the homepage's Collections section. This opens the **Add Collection** modal. For more information, see [Create a collection](/administer/collections#create-a-collection). ### Notification policies Team home pages have a **Notification Policies** section that links to each notification policy associated with the team. ### Links The **Links** section contains links added to a team or collection home. These links can point to any `http` or `https` URL. ### Description Teams and collections can have a text description that's displayed in the **Description** section of their home pages. This description can also appear in other lists that include teams or collections, or when listing them in [Chronoctl](/tooling/chronoctl). ### Team members A team's home page also lists all team members sorted by their [account's](/administer/accounts-teams) email address. The list indicates accounts with administrative access by listing **Admin** with their email address. Service accounts have an email address consisting of its slug followed by `@serviceaccount.chronosphere.io`. ## Edit a home page Each home page generates its content based on its team's or collection's associations with other resources. To update those associations, see the documentation for those resources. ### Teams To edit a team's name, description, or membership, see [Teams](/administer/accounts-teams/teams). Editing these details requires [administrative access](/administer/accounts-teams/user-accounts#grant-system-administrator-sysadmin-privileges-to-users). ### Collections To edit a collection's name, description, or team association, see [Collections](/administer/collections). > [!NOTE] > > Although you can click the ** Edit Collection** button in a collection's > home page and view its name and description, you must use Terraform to update these > details. ### Links To add links to the **Links** section: 1. Go to the team's or collection's home page. 2. Click ** Edit Team** or ** Edit Collection**. 3. Under **Team Links** or **Collection Links**, click **+ Add**. 4. Enter a **Link Name** and **URL**. 5. Click **Save**. To remove links from the **Links** section: 1. Go to the team's or collection's home page. 2. Click ** Edit Team** or ** Edit Collection**. 3. Under **Team Links** or **Collection Links**, click **+ Add**. 4. Click the delete button next to the link you want to delete. 5. Click **Save**. # Configure Command Center groups Source: https://docs-xcor.paloaltonetworks.com/administer/command-center-groups Create and manage the Command Center groups that define the business units shown in the Command Center. Command Center groups define the business units shown in the [Command Center](/observe/command-center). Each group appears as a section in the **Business Observability Overview** panel, listing its SLOs by health state. A group must have a primary SLO to appear in the Command Center. Related SLOs appear alongside the primary SLO within the group. Only tenant admins can create, edit, and delete groups. To open the **Command Center Groups** page, click **Settings** in the **Business Observability Overview** panel of the [Command Center](/observe/command-center). ## Create a group 1. On the **Command Center Groups** page, click **Create group**. 2. In the **Name** field, enter a name for the group. 3. In the **Primary SLO** field, select the SLO that tracks this group's overall health. A group without a primary SLO won't appear in the Command Center. 4. **Optional:** In the **Related SLOs** field, select additional SLOs to display alongside the primary SLO in the group. 5. Click **Create**. ## Edit a group 1. On the **Command Center Groups** page, click the edit icon next to the group. 2. Update the fields as needed. 3. Click **Save**. ## Delete a group 1. On the **Command Center Groups** page, click the delete icon next to the group. 2. In the confirmation dialog, click **Delete**. Deleting a group removes it from the Command Center. This action can't be undone. # Design service level objectives Source: https://docs-xcor.paloaltonetworks.com/administer/design-slos Learn about fundamental concepts and best practices when designing service level objectives (SLOs) in Palo Alto Networks Cortex XCOR. Effective service level objectives (SLOs) can take time and research to create. Although Palo Alto Networks Cortex XCOR [SLOs](/observe/slo) are built around industry best practices, you can tailor your SLOs to make them more effective alerting and observation tools for your individual services. ## Design user-focused indicators SLOs should measure availability of your services from your users' perspective. Design your SLOs to identify when services are falling short of your users' needs. Availability isn't always a binary state of up or down. Define your service level indicators (SLIs) with your users' experience in mind. Slow responses, non-blocking errors, or unexpected results can represent a lack of service availability from your users' perspective, even if your service is technically available and responsive. Cortex XCOR SLOs are dynamic and can provide multiple error budgets from a single query. Leverage these features when designing your indicators to create low-maintenance SLOs that are also focused on metrics relevant to your users' experience. Some services might require tracking multiple SLI definitions, such as tracking both latency and availability. In such situations, each SLI should have its own SLO page with its own burn rate and alerting configuration. ## Set a reasonable objective Although it might seem ideal to set a perfect target of 100% availability as your objective, SLOs are most effective when they recognize that issues are inevitable. Instead of aiming for perfection, define your objectives around your users' tolerance for failures to meet their expectations. This tolerance is inherently subjective. Beyond minimums set in legal agreements and SLAs, you can iterate on your SLOs based on user feedback and research, your development pace, and your ability to absorb risk. Likewise, the error budgets created by your objectives help you define the amount of risk you're willing to accept for a given service. This in turn helps you [plan risky actions](#design-slos-for-risk-management), such as potentially disruptive deployments, around your users' tolerance for downtime. If possible, define your objective based on historical performance to ensure your targets are realistic, and also to minimize on-call burdens on your responders. ## Determine an appropriate unit to measure * Error ratio objectives help you identify issues with services where you have a low tolerance for any number of errors. * Time slice objectives help you identify issues with services where the length of an incident is more relevant than the total number of errors, and can reduce the noise of transient or low-impact errors. Many SLOs measure the ratio of errors to total measurements over a time window. Cortex XCOR refers to these as *error ratio SLO*. The resulting percentile provides a straightforward indicator of the measured service's health over time. Its error budget also refers to the ratio of errors that can be tolerated over the remaining time window before the objective is breached. Error ratio SLOs can be valuable when your service has a low tolerance for errors of any type, regardless of how long they degrade the service's performance. Since all errors count against the error budget in an error ratio objective, you can track patterns of error counts over time to identify periodic or intermittent errors before they degrade your service's availability. Burn rate measurements can also alert you to spikes in errors at the early stages of an incident. However, total error counts might not accurately reflect a service's availability. The amount of time during which the service's performance was degraded can matter more to end users than the total number of recorded errors. For such services, use a *time slice SLO*, which instead measures intervals within the time window to determine how long a service was degraded. In a time slice SLO, the indicator and error budget refer to the percentage of time during the time window that the service was available or degraded. Instead of a certain number of errors triggering an objective's breach, a time slice SLO is breached when the system is degraded for a percentage of time during the window that exceeds the objective. Time slice SLOs use intervals as small as one to five minutes. Choose the interval based on your service's behavior when degraded and its affects on the service's users. Since each slice is calculated independently, the objective only needs to aggregate data for each time slice, instead of across the entire time window, which can be weeks in length. Services that can benefit from time slice SLOs might experience relatively uniform load over the time window, don't have scheduled or expected downtime or outages, and can safely recover from intermittent errors. However, these traits can mask occurrences of low-impact and intermittent errors that still occur but fail to breach the threshold of each time slice. Time slice SLOs can also delay responses to incidents and burn rate measurements, especially over longer time slice intervals, since the success or failure of a slice can be determined only when it breaches the slice's threshold. ## Use template variables to reduce query maintenance If you write your SLO's query, use [template variables](/investigate/alerts/manage-slos) to refer to your time window (`{{.Window}}`) or time slice interval (`{{.TimeSlice}}`), dimensions (`{{.GroupBy}}`), and label filters (`{{.AdditionalFilters}}`). These variables automatically align your query to SLO changes, and also help facilitate configuration as code by single-sourcing their definitions. ## Tune time window and burn rate definitions Cortex XCOR uses opinionated default time windows and multi-window burn rates, all based on industry best practices. If you intend to change time window and burn rate definitions, ensure that they remain realistic and stay mindful of the alerting noise that might result from changes. When redefining time windows and burn rates, consider the following: * Prioritize alerts: Ensure that alerts are prioritized by severity so that higher burn rates trigger more urgent action than long-term trends or slower burn rates. * Mind services' traffic volume: Services with lower traffic levels might have inconsistent or spiky error rates that cause false positives. Use windows with longer time frames and more conservative burn rates to reduce noise in your alerts. ## Design SLOs for rapid response to issues An SLI measures your service's error rates across a defined time window to determine whether your service achieves its objective. The SLO also provides tools that help responders protect your service from breaching its objective. Burn rates measure your error rates in time windows as small as several minutes, rather than days or weeks. Burn rates can trigger alerts on the implication that if a high error rate across a short time span continues unabated, then your SLO will breach its objective before the end of its time window. Cortex XCOR defaults provide multiple burn rates. SLOs provide measurements across multiple windows per burn rate to reduce false positives. By setting burn rate alerts, your SLO can identify and alert responders when a service rapidly experiences more errors or downtime than expected. Your responders can then intervene long before the error budget is exhausted. ## Design SLOs for risk management You can also use SLOs in risk management and planning. Error budgets are designed to be spent, and you can use them to plan upcoming deployments that you know might deplete them. For example, downtime from planned deployments and maintenance activities are part of your error budget, and burn rate alerting can help you identify and react when such planned actions have unexpected user-facing results. Consider your error budget separately from your SLO objective. If you set a 99% objective, consider your 1% error budget as its own amount of capacity that you can spend on risky deployment or maintenance actions. Burn rates measure consumption of your error budget rather than your total objective because they extrapolate how much capacity you can sacrifice before your service breaches its objective. Burn rate alerts help responders react to issues as they happen, and also help identify how much downtime your users can tolerate for the rest of your time window. An incident with a high burn rate leaves less error budget for the rest of your time window, which affects how you allocate the remainder. Conversely, reducing the downtime of risky actions gives you more budget to work with for more frequent or riskier actions within your time window. Use burn rate alerts to also alert stakeholders who determine deployment schedules, and use visualizations in an SLO's page to find historical context when planning deployments for future time windows. ## Create effective SLO alerts For managing and responding to degraded service performance and outages, SLOs provide significant benefits compared to other alerting practices: * User-centric measurement: SLOs focus on visualizing and reporting on symptoms rather than causes, which concentrates coverage on issues actively affecting your services and reduces false positives. * Standardized operational practices: The standardized features and presentation of SLOs facilitate normalized alerts, dashboards, and operational reviews across your organization to improve consistency in team transitions and on-call rotations. * Data-driven decision making: By measuring error budgets against availability targets, SLOs provide objective data toward balancing investments in a service's reliability against new feature development. This allows for more consistent risk management while you iterate on the service's implementation. When you [define your SLO](/investigate/alerts/manage-slos#define-an-slo), use the **SLO** tab in the **SLO preview** drawer to simulate alerts. This tab uses real data to project where your SLO would have triggered alerts, and you can update those simulations after tuning your objective and burn rates. ### Avoid high-impact alerts on new SLOs New SLOs often require some iteration and tuning to become effective alerting tools. The best-designed objectives and alerts can still result in alerts triggering too quickly or too often. For new SLOs, create alerts with a trial period of a few weeks. Use lower-impact notification policies during this period to avoid recurring alerts, and use this period to tune your SLO's objective, burn rates, and alerting settings. After you've ensured that the SLO alerts your responders only when necessary, switch your SLO to a higher-impact notification policy. ## Use SLOs with other Cortex XCOR features In addition to alerts, Cortex XCOR SLO integrate with other features that help you identify, analyze, and investigate issues. * Use [Differential Diagnosis (DDx) for metrics](/investigate/analyze/differential-diagnosis/metrics) from SLO visualization panels to help identify the source of spikes or other unusual shapes. * Connect SLOs to [services](/observe/services), which includes the SLO's status with other monitors when depicting the service's health. This can draw responders' attention to SLOs when viewing a [service page](/observe/services/service-pages). ## Further reading SLOs are a complex subject, and resources from across the observability industry can help you better understand them and improve your SLO designs. * [SRE Fundamentals: SLA versus SLO versus SLI](https://chronosphere.io/learn/know-the-sre-fundamentals-differences-between-sli-vs-slo-vs-sla/) in Cortex XCOR Resource Center provides a high-level overview of SLO components, purpose, and terminology. * [The Art of SLOs](https://sre.google/resources/practices-and-processes/art-of-slos/) workshop by Google's SRE team provides a theoretical basis and practical hands-on examples of effective indicators and objectives. # Licensing and system limits Source: https://docs-xcor.paloaltonetworks.com/administer/limits-licensing Learn about licensing and system limits and how they differ. Palo Alto Networks Cortex XCOR enforces two categories of limits that govern how telemetry data flows through the system: license limits and system limits. To stay within defined limits, [control your telemetry data](/control) to manage data volume. ## License limits License limits are defined in your contract and track telemetry usage against your purchased capacity. Licensing applies across metrics, traces, logs, and change events, and is measured by using dimensions such as persisted writes, matched writes, and persisted cardinality. Organizations that purchase credits can spend a single pool of capacity across any telemetry type. Track consumption against your budgets using the [License Overview](/administer/limits-licensing/licensing), which surfaces snapshot and trend views per telemetry type. Refer to these pages for terminology about licensing in Cortex XCOR: * [Concepts](/administer/limits-licensing/concepts) describe licensing concepts across telemetry types. * [Definitions](/administer/limits-licensing/definitions) provide formal definitions of units like credits, persistence, and resolution. ## System limits System limits are technical constraints that protect Cortex XCOR from instability caused by abnormal traffic patterns. For organizations that use consumption pricing, consumption system limits restrict rapid increases in metrics, logs, and traces volume. View the thresholds, utilization, and dropped data for your tenant in the [Consumption System Limits dashboard](/observe/dashboards/managed-dashboards#consumption-system-limits). Consumption system limits apply separately from contract credit consumption and customer-configured budgets. Contact [Cortex XCOR Support](/support) to request an adjustment to these limits. Cortex XCOR also applies data validation, ingestion, and query protections for each telemetry type. See [system limits](/administer/limits-licensing/limits) for details. # Licensing concepts Source: https://docs-xcor.paloaltonetworks.com/administer/limits-licensing/concepts Learn about telemetry data licensing concepts and usage in Palo Alto Networks Cortex XCOR. Palo Alto Networks Cortex XCOR supports two pricing models: consumption and capacity. Your contract with Palo Alto Networks determines which model applies to your tenant. Each model has its own set of licensing concepts that govern how usage is measured, reported, and controlled. ## Consumption pricing In the consumption model, your organization purchases a pool of [credits](/administer/limits-licensing/licensing#credits-consumption) over a defined contract period and spends them across any telemetry type. Usage is measured in volume-based units such as persisted series, data points, and bytes, each with a per-unit credit price. The consumption model provides flexibility to shift spend between metrics, logs, and traces as operational needs change. To protect against overspending, configure [budgets](/control/consumption/budgeting) with thresholds that alert or drop data before credit exhaustion. For the full list of consumption licensing concepts and how each unit is counted, see [Consumption licensing](/administer/limits-licensing/concepts/consumption-licensing). ## Capacity pricing In the capacity model, your organization contracts for fixed rate limits measured in data points per second (DPPS) and active time series cardinality. Exceeding these limits incurs penalties that can result in dropped data. Capacity limits are enforced across three dimensions: persisted writes, matched writes, and persisted cardinality. To control which data drops first when limits are reached, configure [quotas](/control/shaping/shape-metrics/quotas) and split total system capacity into per-pool allocations. For the full list of capacity licensing concepts, metrics, and limit management strategies, see [Capacity licensing](/administer/limits-licensing/concepts/capacity-licensing). # Capacity licensing concepts Source: https://docs-xcor.paloaltonetworks.com/administer/limits-licensing/concepts/capacity-licensing Learn about metrics licensing concepts and usage in Palo Alto Networks Cortex XCOR in a capacity licensing model. In a capacity model, [quotas](/control/shaping/shape-metrics/quotas) determine which data drops first. You can split the total system-persisted writes per second into per-pool quota allocations. In a capacity model, Palo Alto Networks Cortex XCOR defines two types of metric licenses: the **Standard Metrics License** and **Histogram Metrics License**. ## Standard Metrics License The Standard Metrics License measures aggregations, persisted writes, and persisted cardinality license consumption for the following Cortex XCOR metric types: * Cumulative counter * Delta counter * Gauge > [!NOTE] > > Because Cortex XCOR aggregates and persists legacy Prometheus histograms > and OpenTelemetry explicit bucket layout histograms as cumulative or delta counters, > these metrics consume Standard Metrics License capacity. ## Histogram Metrics License The Cortex XCOR histogram metric type supports both OpenTelemetry exponential histograms and Prometheus native histograms. The Histogram Metrics License measures aggregations, persisted writes, and persisted cardinality license consumption for the following Cortex XCOR metric types: * Cumulative exponential histogram * Delta exponential histogram Use the **Trends** tab of the [**License Overview**](/administer/limits-licensing/licensing) page to observe histogram persisted writes, matched writes, and persisted cardinality in the **Metrics consumption trends** graph. ## Capacity license metrics The following metrics apply in a capacity licensing model. ### Matched writes *Matched writes* are the number of writes per second being matched for transformation and reshaping by the Cortex XCOR aggregation tier. A matched write is counted for each data point matched into each aggregator rule, whether [rollup](/control/shaping/shape-metrics/rules/rollup) or [downsampling](/control/shaping/shape-metrics#downsample-data). If a data point matches one rule, that's one matched write. If a data point matches two rules, that's two matched writes. The sum of the matched data points per second per rule equals the total matched writes. [Recording rules](/control/shaping/shape-metrics/rules/recording) aren't considered an aggregation rule for the purpose of counting matched writes. Writes also depend on your [Collector scrape interval](/ingest/metrics-traces/collector/discover/scrape-configuration#global-scrape-configuration). Increasing the scrape interval produces fewer writes, but can reduce visibility. See your current **Matched Writes** level in the [**License Overview**](/administer/limits-licensing/licensing) **Snapshot** in the **Metrics Consumption** section. On the **Trends** page, review usage over time in the **Metrics Consumption Trends** graph. #### Matched writes metrics The following metrics apply to [matched writes](#matched-writes), which are the number of writes per second being matched for transformation and reshaping by the Cortex XCOR aggregation tier. | Metric name | Description | | - | - | | `chrono_metrics_matched_writes_license_dpps_limit` | License limit for matched write DPPS by datapoint type. | | `chrono_metrics_matched_writes_license_dpps_capacity` | Capacity limit for matched write DPPS by datapoint type. | | `chrono_metrics_matched_writes_license_dpps_consumed` | Consumption rate in DPPS of matched write license by datapoint type. | Query the following metric to understand if data is actively being dropped: ```text theme={null} chrono_metrics_matched_license_dpps_dropped ``` ### Persisted writes The number of persisted writes to the Cortex XCOR database consists of the following: ```text theme={null} (Number of unaggregated, raw data points written to the database) + (Number of aggregated data points written to the database) ``` If you exceed 100% of your persisted writes capacity limit, data points will be dropped before being persisted. To improve and enhance performance, stability, and features, Cortex XCOR adds a small number of additional time series to your database. These data points aren't counted against your license. You can review your current usage in the **Persisted writes** graph on the [**License Overview**](/administer/limits-licensing/licensing) **Snapshot** page, in the **Metrics consumption** section. To see changes over time, select **Trends**, and review the **Metrics consumption trends** graph. #### Persisted writes metrics The following metrics apply to [persisted writes](#persisted-writes). | Metric name | Description | | - | - | | `chrono_metrics_persisted_writes_license_dpps_limit` | License limit for persisted write DPPS by datapoint type. | | `chrono_metrics_persisted_writes_license_dpps_capacity` | Capacity limit for persisted write DPPS by datapoint type. | | `chrono_metrics_persisted_writes_license_dpps_consumed` | Consumption rate in DPPS of persisted write license by datapoint type. | For each of these metrics, you can query by `datapoint_type`, such as `histogram` or `standard`. For the `_dpps_capacity` and `_dpps_consumed` metrics, you can additionally query by `pool_name`, and `priority`. For example, the following query returns the consumption rate in DPPS of your persisted write license for `histogram` data points on the `Auth Services` pool. Because `priority` isn't specified, the query returns a series for each priority: ```text wrap theme={null} chrono_metrics_persisted_writes_license_dpps_consumed{datapoint_type="histogram", pool_name="Auth Services"} ``` If you wanted to return only high priority histogram data points for the `Auth Services` pool, specify `priority = "high"` in your query: ```text wrap theme={null} chrono_metrics_persisted_writes_license_dpps_consumed{datapoint_type="histogram", pool_name="Auth Services", priority="high"} ``` Query the following metric to understand if data is actively being dropped: ```text theme={null} chrono_metrics_persisted_license_dpps_dropped{limit="persisted_writes"} ``` ### Persisted cardinality [Matched writes](#matched-writes) and [persisted writes](#persisted-writes) measure the rate of data points per second at any given moment in time. Persisted cardinality operates differently, because it's a *cumulative* measure that calculates the count of the unique time series of the persisted writes that Cortex XCOR stores, seen over the last 2.5 hours. This measure is also known as Active Time Series (ATS). Persisted cardinality can be influenced by a change in ingested metrics, or you can use [rollup rules](/control/shaping/shape-metrics/rules/rollup) to downsample and aggregate metrics before they're stored. Because this measure is cumulative, reductions in persisted cardinality aren't reflected immediately, as inactive time series continue counting until they fall outside the 2.5 hour rolling window. Read more about persisted cardinality limits work and how to manage them: * [Learn how persisted cardinality limits work](#how-persisted-cardinality-limits-work) * [Manage persisted cardinality limits](#manage-persisted-cardinality-limits) * [Avoid persisted cardinality limits](#avoid-persisted-cardinality-limits) To see persisted cardinality license usage changes over time, in the [**License Overview**](/administer/limits-licensing/licensing) select **Trends**, and review the **Metrics consumption trends** graph. #### Persisted cardinality metrics The following metrics apply to [persisted cardinality](/administer/limits-licensing/concepts/capacity-licensing#persisted-cardinality). | Metric name | Description | | - | - | | `chrono_metrics_persisted_cardinality_license_limit` | License limit for active persisted time series cardinality. | | `chrono_metrics_persisted_cardinality_license_capacity` | Capacity limit for active persisted time series cardinality. | | `chrono_metrics_persisted_cardinality_license_consumed` | Consumption of the persisted write cardinality limit by datapoint type. | Query the following metric to understand if data is actively being dropped: ```text theme={null} chrono_metrics_persisted_license_dpps_dropped{limit="persisted_cardinality"} ``` #### How persisted cardinality limits work Persisted cardinality is comparable to a leaky bucket. Over time, new series can be added until the bucket is full. When the bucket is at maximum capacity, there's no space for new time series, so they're rejected. When existing time series expire, they make room for new series. In the following example, the persisted cardinality capacity is five unique time series. The animated image shows the lifecycle of six, unique time series (A, B, C, D, E, and F) as new data points are added, and as other data points expire. ![Animated image showing data points being introduced. When the persisted cardinality limit is reached, no more time series are accepted.](https://mintcdn.com/chronosphere-74b1ef6e/maN6AfQNlYHqDQGU/public/doc-assets/cardinality-data-flow.gif?s=e4b85c56ab8c0173db93cb025bf54152) As data points are introduced, they're either accepted or rejected based on whether the persisted cardinality bucket is full (reached maximum capacity), and whether the related time series already exists in the bucket: * If the bucket is at maximum capacity and the series already exists, the data point is accepted. * If the bucket is at maximum capacity and the series doesn't exist, the series is rejected. The following table shows how data points A3, E1, and F1 are processed, based on the bucket status: | Data point | Status | Description | | - | - | - | | A3 | Accepted | Time series A is in the bucket, so data point A3 is accepted. | | E1 | Accepted | Time series E isn't in the bucket, but the bucket has space for one more time series, so data point E1 is accepted in time series E. | | F1 | Rejected | Time series F isn't in the bucket, and the bucket is at capacity, so data point F1 is rejected. | Over time, data points expire based on when they entered the bucket. When data points exceed the 2.5 hour window, they're excluded from the persisted cardinality bucket. In the example, data points A1 and D1 expired, so they're excluded from the bucket. When data point C1 expires, it's also excluded. Because data point C1 is the last data point in time series C, the entire series is removed, making space for a new time series in the bucket. | Data point | Status | Description | | - | - | - | | A1 | Expired | Data point A1 expired, so it's excluded from the bucket. | | D1 | Expired | Data point A1 expired, so it's excluded from the bucket. | | C1 | Expired | Data point C1 is expiring, so it's excluded from the bucket. | #### Manage persisted cardinality limits If your organization exceeds 100% of their Persisted Cardinality Capacity Limit, data points for any new time series not seen in the last 2.5 hours will be dropped until you're under this limit. Data points for existing time series will continue to be persisted. Series that are more stable or regularly emitted aren't at risk of being dropped because they're always in the system, and aren't categorized as new series. For example, series that don't change any labels are considered more stable. To fully resolve a penalty period, the rate of new series must be less than the rate of expiring series. The higher the differential between these rates, the faster the penalty resolves. To manage persisted cardinality limits: * Review the [Persisted Cardinality Quotas](/observe/dashboards/managed-dashboards#persisted-cardinality-quotas) dashboard, the [Usage Dashboard](/observe/dashboards/managed-dashboards#usage-dashboard) and the [Metric Growth](/observe/dashboards/managed-dashboards#metric-growth) dashboard to understand the source of cardinality growth. * Create [drop rules](/control/shaping/shape-metrics/rules/drop-rules) and [aggregation rules](/control/shaping/shape-metrics/rules) like mapping rules and rollup rules to roll away sources of growth. Old series remain in the cardinality window for 2.5 hrs. * Use the [Recommendations](/control/shaping/shape-metrics/reduce-cardinality/recommendations) page to help identify metrics and labels with no usage or utility over the past 30 days. You can then create drop rules and rollup rules based on the recommendations. The 2.5 hour expiration window is a rolling window, which means the constant rate of expiring series makes room for an equal rate of new series to be added. This behavior means the penalty period you experience can be much shorter than 2.5 hours. Queries with time ranges that overlap with penalty periods can produce inconsistent or partial results due to the dropping of time series during those periods. #### Avoid persisted cardinality limits Create [thresholds](/control/consumption/budgeting) on budgets to help manage both anomalous spikes in data and slow data growth over time. Configure actions on each threshold. Fixed-volume drop thresholds discard all matching data after the limit is exhausted until the window resets. Use the following tools and techniques to avoid hitting persisted cardinality limits: * Review the [Persisted Cardinality Quotas](/observe/dashboards/managed-dashboards#persisted-cardinality-quotas) dashboard, the [Usage Dashboard](/observe/dashboards/managed-dashboards#usage-dashboard) and the [Metric Growth](/observe/dashboards/managed-dashboards#metric-growth) dashboard to understand the source of cardinality growth. * Learn about different methods to [reduce cardinality](/control/shaping/shape-metrics/reduce-cardinality). * Proactively create [drop rules](/control/shaping/shape-metrics/rules/drop-rules) and [aggregation rules](/control/shaping/shape-metrics/rules) like mapping rules and rollup rules ahead of potential overages to evict older time series and make room for new ones. * Proactively define [thresholds](/control/consumption/budgeting) on budgets to better manage persisted cardinality. * If your organization knows which new metrics services are generating, try to control the rate that new series are introduced through smaller, more incremental deploys. ## Capacity limits > [!NOTE] > > Capacity limits only apply to capacity pricing. If your organization uses the > consumption model, see [Manage consumption](/control/consumption). Capacity limits indicate your maximum license capacity for telemetry data in Cortex XCOR. Exceeding your capacity limits incurs penalties, which can result in dropped data. Dropped data can affect dashboards, alerts, and other reports. Licensing capacity is based on your telemetry types and usage. The license limit indicates your contractual license with Cortex XCOR. The capacity and license limits display in the **Contracts** tab of the [**License Overview**](/administer/limits-licensing/licensing) page. These limits are broken down into individual limit graphs: * **Persisted writes** * **Matched writes** * **Persisted cardinality** * **Histogram persisted writes** * **Histogram matched writes** * **Histogram persisted cardinality** Cortex XCOR recommends creating [alerts](/investigate/alerts) using the existing capacity limit metrics, which are also used in the [License Overview](/administer/limits-licensing/licensing). Use alerts to be notified when you're close to or over 100% of your license limit and therefore at risk of experiencing drops. ## Legacy licensing metrics The following table explains metrics that might be present in your environment, but will be replaced by new metrics. The following metrics replace this table: * [Persisted writes](#persisted-writes) * [Persisted cardinality](#persisted-cardinality) * [Matched writes](#matched-writes) These metrics create the following tags during [dashboard creation](/observe/dashboards#create-a-dashboard): * `chronosphere_service` | Metric name | [Metric type](/control/shaping/shape-metrics/types) | Description | | - | - | - | | `limit_service_cardinality_count` replaced by `chrono_metrics_persisted_cardinality_license_consumed` | Counter | Current cardinality count across all Collectors. | | `limit_service_licensed_cardinality_limit` replaced by `chrono_metrics_persisted_cardinality_license_limit` | Counter | Current cardinality limit across all Collectors. | | `limit_service_licensed_persist_limit` replaced by `chrono_metrics_persisted_writes_license_dpps_limit` | Counter | Current limit for data points persisted in the database across all Collectors, as defined in the contract. | | `limit_service_capacity_limit` | Counter | Current capacity limit for data points persisted in the database across all Collectors, based on grant by Cortex XCOR. | | `limit_service_persisted_count` replaced by `chrono_metrics_persisted_writes_license_dpps_consumed` | Counter | Total number of data points persisted in database. | | `limit_service_matched_limit` replaced by `chrono_metrics_matched_writes_license_dpps_limit` | Counter | Current license limit for matched write DPPS by datapoint type. | | `limit_service_capacity_limit` replaced by `chrono_metrics_matched_writes_license_dpps_capacity` | Counter | Current capacity limit for matched write DPPS by datapoint type. | | `chronosphere_rule_metrics_matched` replaced by `chrono_metrics_matched_writes_license_dpps_consumed` | Counter | Consumption rate in DPPS of matched write license by datapoint type. | # Consumption licensing concepts Source: https://docs-xcor.paloaltonetworks.com/administer/limits-licensing/concepts/consumption-licensing Learn about licensing concepts in Palo Alto Networks Cortex XCOR in a consumption model. In a [consumption](/control/consumption) model, configure [budgets](/control/consumption/budgeting) to take action and protect against overspending. For each budget, define thresholds and priorities to define the actions to take when a threshold is exceeded, and control the data that gets dropped. You can then attach budgets to a [partition](/control/consumption/partitions). The consumption model includes the following concepts, which are volume-based licensing resources for telemetry data that you can spend [credits](/administer/limits-licensing/licensing#credits-consumption) on. ## Logging license consumption Spend credits flexibly across the following log resources in the consumption model: * Persisted bytes: Log bytes stored in the database. * Processed bytes: Log bytes matched for transformation and reshaping. ## Tracing license consumption Spend credits flexibly across the following trace resources in the consumption model. * Persisted bytes: Trace bytes stored in the database. * Processed bytes: Trace bytes matched for transformation and reshaping. ## Metrics license consumption Spend credits flexibly across the following metric resources in the consumption model. ### Metrics persisted datapoint A metrics *persisted datapoint* is an individual, timestamped data point that Palo Alto Networks Cortex XCOR persists to storage. Each persisted data point counts as exactly one unit, regardless of metric type. Persisted datapoint pricing varies by effective datapoint resolution (EDR). EDR is the average time between consecutive persisted data points of a time series, computed across all persisted series and data points in your tenant. ### Metrics persisted series A metrics persisted series is a unique time series, defined by a distinct combination of metric name and labels, that Cortex XCOR persists to storage. Unlike [capacity licensing](/administer/limits-licensing/concepts/capacity-licensing#persisted-cardinality), which counts all active time series within a 2.5-hour rolling window, the consumption model counts one time for each unique persisted series when first observed. #### How persisted series counting works In the consumption model, a persisted series is counted only the first time a unique time series (a specific combination of metric name and labels) is saved to storage. The following animated image shows five instances of a service deploying at a four-minute interval. Each instance produces one unique series, for a total of five persisted series. Because each series is counted only once at first observation, the total persisted series count is five, regardless of how many data points those series produce over time. ![Animated image showing how persisted series are counted as five service instances deploy.](https://mintcdn.com/chronosphere-74b1ef6e/-Q3k0ObEuoCkeKuQ/public/doc-assets/consumption-persisted-series.gif?s=13d3adbfc76438863148741e71982a2b) Cortex XCOR uses a 48-hour window to determine whether a series is new. If a time series continuously receives data points, or reappears within 48 hours of its last write, it isn't counted again. Only if a series reappears after a gap of more than 48 hours is it treated as new and incurs a new persisted series charge. The following example shows an incoming series, followed by gap that exceeds the 48-hour window. Any series after that period is considered a new series, which incurs a new persisted series charge. ![Animated image showing how data series are calculated across a 48-hour window.](https://mintcdn.com/chronosphere-74b1ef6e/-Q3k0ObEuoCkeKuQ/public/doc-assets/cardinality-gaps.png?fit=max\&auto=format\&n=-Q3k0ObEuoCkeKuQ\&q=85\&s=8f4a1df6f3c10e5b01a51594d5b853fa) In practice, the vast majority of time series receive data points continuously for their lifetime and are counted only once. The 48-hour window prevents double-counting for series with brief gaps, rather than defining what's active at any moment. #### How the consumption model differs from capacity In the capacity model, the 2.5-hour window is inclusive: all series seen within the window count toward the cardinality limit, regardless of whether they're still actively emitting. Churn inflates the count because both old and new series overlap in the window. In the consumption model, the 48-hour window is exclusive: it prevents recently seen series from being double-counted. A longer window reduces duplicate charges, and 48 hours is long enough that most series are never counted more than once. This separation means cardinality in the consumption model reflects the actual number of distinct series persisted, independent of timing effects. ### Combining persisted series and data points In the consumption model, persisted data points and persisted series form the two distinct halves of your total persistence cost, acting together to separate cardinality from volume: * Persisted series: captures how many unique time series exist. Counted once per unique series at first observation. * Persisted data points: captures how much data those series produce over time. Counted for every data point written to storage. The previous [animated image](#how-persisted-series-counting-works) contains five instances. With an effective datapoint resolution (EDR) of 60 seconds, if each series emits one data point per minute over a four-minute interval, the persisted data points total 20: ```text theme={null} five series * four data points per series = 20 persisted data points ``` The persisted series count remains five because each series is counted only once, while the persisted data points count grows with each data point written. ### Metrics persisted histogram datapoint bucket A metrics *persisted histogram datapoint bucket* is a bucket within a histogram data point that Cortex XCOR persists to storage. One persisted histogram datapoint bucket is incurred for each non-zero bucket within a persisted histogram datapoint. Only populated bucket positions in the histogram's sparse encoding are counted. ### Metrics matched datapoint A metrics *matched datapoint* is a data point matched for aggregation. One matched data point is incurred for each aggregation rule matched for each datapoint. If a data point matches one rule, that's one matched datapoint. If a data point matches two rules, that's two matched data points. [Recording rules](/control/shaping/shape-metrics/rules/recording) don't count toward matched data points. ### Metrics matched histogram datapoint bucket A metrics *matched histogram datapoint bucket* is a bucket within a histogram data point matched for aggregation. One matched histogram datapoint bucket is incurred for each non-zero bucket within a matched histogram datapoint, multiplied by the number of aggregation rules matched. # License unit definitions Source: https://docs-xcor.paloaltonetworks.com/administer/limits-licensing/definitions Learn about licensing unit concepts in Palo Alto Networks Cortex XCOR. Palo Alto Networks Cortex XCOR uses the following definitions for licensing units across both capacity and consumption models: * *Control* is the volume of data that undergoes transformation and reshaping. Control is measured in `GB` for traces, `GB` for logs, and matched writes for metrics. * *Long Term Retention* is the number of months Cortex XCOR will retain data at a negotiated resolution. * *Persistence* is the volume of data stored following processing by control. Persistence is measured in `GB` for traces, `GB` for logs, `WPM` for events, and cardinality and resolution for metrics. * *Raw Retention* is the number of days Cortex XCOR will retain raw data. For more information, see [ingestion limits and retention policies](/administer/limits-licensing/licensing#contract-details). * *Resolution* is the ratio of active time series to persisted writes per second. * *Time series* is a set of data points with matching labels. ## Consumption definitions The following definitions apply only to the [consumption pricing model](/control/consumption) that uses partitions and budgets to control your telemetry data usage: * *Credits* are a flexible, fungible unit of currency that you can spend on any telemetry type without needing to renegotiate your contract. Learn more about [Credits consumption](/administer/limits-licensing/licensing#credits-consumption) to understand how credits work in the consumption pricing model. * *Effective Datapoint Resolution* (EDR) represents the average time interval between data points for your time series. * *Metrics Matched Datapoint* is a data point matched for aggregation. One Metrics Matched Datapoint is incurred for each aggregation rule matched for each data point. * *Metrics Matched Histogram Datapoint Bucket* is a bucket within a histogram data point matched for aggregation. One Metrics Matched Histogram Datapoint Bucket is incurred for each non-zero bucket within a matched histogram data point. * *Metrics Persisted Datapoint* is an individual, timestamped data point that's persisted to storage. Metrics Persisted Datapoints pricing varies by Effective Datapoint Resolution. * *Metrics Persisted Histogram Datapoint Bucket* is a bucket within a histogram data point that's persisted to storage. One Metrics Persisted Histogram Datapoint Bucket is incurred for each non-zero bucket within a persisted histogram data point. * *Metrics Persisted Series* is a time series, defined as a combination of metric name and labels, that's persisted to storage. One Metrics Persisted Series is incurred for a time series if no identical time series have been persisted in the last 48 hours. Metrics Persisted Series pricing varies by storage retention. ## Capacity definitions The following definitions apply only to the capacity pricing model that uses [quotas and pools](/control/shaping/shape-metrics/quotas) to control your telemetry data usage: * *Matched Writes* (`mW`) are the number of writes per second being matched for transformation and reshaping. For more information, see [matched writes](/administer/limits-licensing/concepts/capacity-licensing#matched-writes). * *Persisted Cardinality* is the count of unique time series of the persisted writes stored by Cortex XCOR. For more information, see [persisted cardinality](/administer/limits-licensing/concepts/capacity-licensing#persisted-cardinality). * *Persisted Writes Per Minute* (`WPM`) is the total count of individual, timestamped data points persisted in a one-minute interval. For more information, see [persisted writes](/administer/limits-licensing/concepts/capacity-licensing#persisted-writes). * *Persisted Writes Per Second* (`WPS`) is the total count of individual, timestamped data points persisted in a one-second interval. # Cortex XCOR licensing Source: https://docs-xcor.paloaltonetworks.com/administer/limits-licensing/licensing Learn about licensing concepts and retention periods in Palo Alto Networks Cortex XCOR. To track your telemetry usage against your licensing dimensions, use **License Overview**. Palo Alto Networks Cortex XCOR provides this overview to monitor data usage against your licensing dimensions. Use the overview charts to help identify usage trends across data types and proactively manage data usage to avoid exceeding your organization's licensing limits. The **License Overview** is available in your Cortex XCOR tenant. In the navigation menu, click ** Go to admin view**, and then select ** License > License Overview**. The **License Overview** page consists of two main sections, [**Consumption**](#consumption-tracking) and [**Contract**](#contract-details), selectable by tab. ## Consumption tracking The **Consumption** tab captures the current consumption rates across all license dimensions, compared to your license limits. These statistics display across two selectable tabs for **Snapshot** and overall **Trends**: * **Snapshot** is an overview of your current license usage. When selected, this page displays each licensing statistic as a percentage of your contract limit, along with a graph for that statistic over a pre-selected time period. * **Trends** explains how your license usage has changed over the selected time period, grouped and graphed by telemetry type. License dimensions currently exceeding capacity highlight in red, and licenses close to exceeding capacity are orange. ### Metrics consumption Use the **License Overview** to track metrics consumption against your metrics license dimensions: * On the **Snapshot** page, the **Metrics consumption** section displays aspects of processed, persisted, and matched metrics data, measured in bytes. Panels also display this information for histogram data. These panels include: * Current percentage gauges for persisted writes, matched writes, and persisted cardinality that display consumption versus capacity. * Seven-day trend lines that plot consumption against capacity so you can spot trends from week to week. For most users, the processed and persisted consumption rates are for the current month. If your organization uses consumption-based pricing, then the processed and persisted bytes are measured against your contract to date. * On the **Trends** page, you can view metrics consumption trends in higher resolution. If your organization uses consumption-based pricing, click the link to view consumption trends in the [**Consumption**](/control/consumption/analyze) page. ### Tracing consumption Use the **License Overview** to track trace consumption against your tracing license dimensions: * On the **Snapshot** page, the **Traces consumption** section displays aspects of processed and persisted tracing data, measured in bytes. These include: * Daily average rates per second * Month-to-date cumulative trends For most users, the processed and persisted consumption rates are for the current month. If your organization uses consumption-based pricing, then the processed and persisted bytes are measured against your contract to date. To help control costs and maximize the usefulness of your tracing data, click **Go to Trace Optimization** to [sample your traces](/control/shaping/sample-traces). * On the **Trends** page, you can view trace consumption trends in higher resolution. If your organization uses consumption-based pricing, click the link to view consumption trends in the [**Consumption**](/control/consumption/analyze) page. ### Logs consumption Use the **License Overview** page to track log consumption against your logs license dimensions: * On the **Snapshot** page, the **Logging consumption** section displays the following panels and graphs: * Percentage of persisted writes and processed writes consumed against your full licensing contract. * Elapsed time against your full contract. Compare the percentage of persisted writes and processed writes consumption against the time elapsed to understand your true consumption rate. * Daily persisted and processed log data over the past 30 days. * Cumulative trend of persisted data and processed data against the license limit, over the life of your licensing contract. To view log license information, click **Go to Consumption**, which opens the [Consumption page](/control/consumption). * On the **Trends** page, you can view log consumption trends in higher resolution. Trends display for the last seven days by default. The **Persisted** limit displays the number of logs that can persist per minute in your tenant. If your organization uses consumption-based pricing, click the link to view consumption trends in the [**Consumption**](/control/consumption/analyze) page. ### Events consumption Use the **License Overview** to track events consumption against your change events license dimensions: * On the **Snapshot** page, the **Events consumption** graph for **Persisted Capacity** displays the percentage of events consumed against your events license capacity. To filter change events by different attributes, click **Go to Changes Explorer** to open the Changes Explorer page. * On the **Trends** page, you can view event consumption trends in higher resolution. The **Persisted capacity** limit displays the number of events that can persist per minute in your tenant. This limit is enforced and can incur penalties if exceeded. In certain circumstances, this limit can exceed the license limit temporarily. The **Capacity limit** displays the number of events that can persist per minute, as defined by your the license in your contract with Palo Alto Networks. The current consumption percentage displays a decimal ratio of persisted data against your per-minute license limit for the selected time period. This value is calculated by dividing the persisted events per minute by the number of events that can persist per minute, defined by the license limit. Use this information to understand the relationship between your persisted data consumption and the defined license limit. ### Credits consumption > [!NOTE] > > This feature isn't available to all Palo Alto Networks Cortex XCOR users and > might not be visible in your app. For information about enabling this feature in your > environment, contact [Cortex XCOR Support](/support). To pay for telemetry data usage across the Cortex XCOR ecosystem, use *credits*. Credits are a flexible, fungible unit of currency that you can spend on any telemetry type. Instead of buying separate capacities for metrics, logs, and other telemetry, you purchase a pool of credits for a defined contract period. Spend those credits across any product on the platform. On the **Snapshot** page, the **Credit consumption** section includes: * **Credit consumption (full contract)**: The percentage of total contracted credits consumed to date. * **Elapsed time in contract**: The percentage of the contract period that has elapsed. Compare this against credit consumption to gauge spend rate. * **Estimated Credit Runway**: The month and year when the remaining credit balance is forecast to reach zero, based on the previous 60 days of consumption. * **Credits cumulative trend**: A stacked line chart of cumulative credit usage by product over the life of the contract. Forecast lines extend each product's consumption trend through the contract end, based on the previous 60 days of consumption. * **Credit monthly consumption**: A bar chart of credits consumed per month. > [!NOTE] > > The **Credit consumption** section displays for any of your telemetry types that use > consumption pricing and credits. For any telemetry data that uses capacity pricing, > or consumption pricing without credits where you purchase bytes, this section doesn't > display. If a credit contract has expired or is no longer active, a message directs > you to the [Consumption page](/control/consumption/analyze) instead. The estimated runway and forecast lines are planning estimates and can vary as consumption changes. Forecasts require an active contract that covers the full 60-day lookback period and enough recent consumption data. If consumption is too low to calculate a meaningful runway date, the **Estimated Credit Runway** panel displays `N/A`. To view the total number of credits available in your license for the defined contract period, click the **Contract** tab. The **Credits license** panel group includes a pricing table that lists the products enabled in your tenant, the resources included in your license, and the unit price for each resource. The pricing table lists the following resources, grouped by product: #### Metrics | Resource | Unit | Description | | - | - | - | | Persisted series | Million time series | A time series, defined as a combination of metric name and labels, persisted to storage. One persisted series is incurred for a time series if no identical time series have been persisted in the last 48 hours. Pricing varies by storage retention. | | Persisted datapoints | Billion datapoints | An individual, timestamped data point persisted to storage. Pricing varies by effective data point resolution, which is the average time between consecutive persisted data points of a time series. | | Matched datapoints | Billion datapoints | A data point matched for aggregation. One matched data point is incurred for each aggregation rule matched for each data point. | | Persisted histogram datapoint buckets | Billion buckets | A bucket within a histogram data point persisted to storage. One persisted histogram data point bucket is incurred for each non-zero bucket within a persisted histogram data point. | | Matched histogram datapoint buckets | Billion buckets | A bucket within a histogram data point matched for aggregation. One matched histogram data point bucket is incurred for each non-zero bucket within a matched histogram data point. | #### Logs | Resource | Unit | Description | | - | - | - | | Persisted bytes | Gigabyte | Log bytes stored in the database. | | Processed bytes | Gigabyte | Log bytes matched for transformation and reshaping. | #### Traces | Resource | Unit | Description | | - | - | - | | Persisted bytes | Gigabyte | Trace bytes stored in the database. | | Processed bytes | Gigabyte | Trace bytes matched for transformation and reshaping. | Because credits are fungible, your organization isn't locked into fixed capacities for individual features. Spend your credit balance interchangeably across any of the eligible resources as operational needs change. Usage can scale to accommodate short-term demand without triggering budget controls unless your organization configures them to do so. To delegate spend across teams and ensure maximum value from your credit pool, [create budgets](/control/consumption/budgeting) within consumption partitions. Budgets let each team operate within a defined allocation while preserving overall flexibility. If your organization completely exhausts all credits before the end of the defined contract period, further usage incurs additional charges per your contract terms. To ensure that your organization doesn't spend credits before the end of the contract period, use the included control capabilities to [manage consumption](/control/consumption). To analyze consumption across partitions to detect unwanted spikes and understand what's driving growth, click **Go to Consumption**, which opens the [Consumption page](/control/consumption/analyze). ## Contract details The **Contract** tab is a view of your license limits, which are defined in your contract with Palo Alto Networks. This tab displays your licenses by limit type, with graphs for your license versus your capacity. This page also shows your ingestion limits and retention policies. *Retention policies* define the amount of time Cortex XCOR retains telemetry data. Contact [Cortex XCOR Support](/support) to configure the intervals used for your system. These policies might be based on your contract or license. *Ingestion limits* define the amount of raw data Cortex XCOR can ingest. View retention policies for all of your telemetry data in the **Contract** tab of the **License Overview** page. # Cortex XCOR system limits Source: https://docs-xcor.paloaltonetworks.com/administer/limits-licensing/limits Learn about system limits in Palo Alto Networks Cortex XCOR. Palo Alto Networks Cortex XCOR applies system limits to protect itself from failures caused by abnormal traffic patterns, such as sudden, unexpected spikes in data ingestion. For organizations that use consumption pricing, consumption system limits restrict rapid increases in metrics, logs, and traces volume. The [Consumption System Limits dashboard](/observe/dashboards/managed-dashboards#consumption-system-limits) is the source of truth for the limits enforced in your tenant. Use it to view thresholds, utilization, and data dropped by system limit enforcement. Consumption system limits apply separately from contract credit consumption and user-configured budgets. Contact [Cortex XCOR Support](/support) to request an adjustment to these limits. Cortex XCOR also applies data validation, ingestion, and query protections. Learn more about the protections for the following data types: * [Events](/administer/limits-licensing/limits/event-limits): Ingest rate caps and field-level validation for change events. * [Logs](/administer/limits-licensing/limits/log-limits): Maximum individual log size and label length constraints. * [Metrics](/administer/limits-licensing/limits/metric-limits): Label size, label count, total series byte limits, and late- or future-arriving data windows. * [Queries](/administer/limits-licensing/limits/query-limits): Per-query scale protections, browser truncation limits, resource balancing, and automated source rate limits. * [Traces](/administer/limits-licensing/limits/trace-limits): Tag size, span timing validity, trace span count, and per-pod ingest caps. ## Monitor capacity limits For organizations that use capacity pricing, Cortex XCOR enforces [license capacity limits](/administer/limits-licensing/concepts/capacity-licensing#capacity-limits) for telemetry data. Exceeding these limits can put your organization at risk of dropping data. The type of data that's dropped depends on the limit exceeded. Exceeding your organization's license capacity limits can cause you to hit the defined system limits, which shouldn't occur under normal operating circumstances. To prevent your system from reaching system limits, use the following tools and information to ensure that your Cortex XCOR tenant remains under your license capacity limit at all times: * Use the [License Overview](/administer/limits-licensing/licensing) to track your telemetry usage against your licensing. * Review the [cardinality dashboards](/observe/dashboards/managed-dashboards#cardinality-dashboards) to identify information you can use to help reduce cardinality. * Query [key metrics](/administer/limits-licensing/concepts/capacity-licensing#capacity-limits) to understand if Cortex XCOR is actively dropping data. * Use the provided tools and techniques to [avoid hitting persisted cardinality limits](/administer/limits-licensing/concepts/capacity-licensing#avoid-persisted-cardinality-limits). # Change event limits Source: https://docs-xcor.paloaltonetworks.com/administer/limits-licensing/limits/event-limits Reference the ingest rate, request size, and field limits that apply when creating change events with the CreateEvent API. In addition to using Palo Alto Networks Cortex XCOR, you can use the [CreateEvent API](/tooling/api-info/data_definition/operations/CreateEvent) to create change events. This API can ingest 300 change events per minute, per block in a single tenant. The total request size must be less than 1 MB. ## Change event fields The CreateEvent API accepts the following fields with the stated limits: | Field | Description | Required | Validation | Configurable | Failure | | - | - | - | - | - | - | | `title` | Brief description of the change event. | Yes | Maximum of 100 characters. | No | Error | | `source` | Identifies where the data originated. | Yes | Maximum of 50 characters. | No | Error | | `category` | Informs Cortex XCOR about the kind of change event. | Yes | Must be one of: `"alerts"` `"broadcasts"` `"chronosphere"` `"deploys"` `"feature_flags"` `"infrastructure"` `"third_party"` | Yes | Error | | `happened_at` | Indicates when the change event occurred, which defaults to `now` if unset. | No | Must be a Unix epoch timestamp. Can be set only to 24 hours before or after the current time. | Yes, with a restart | Error | | `type` | Differentiates change events within a particular `category` or `source`. | Yes | Maximum of 50 characters. | No | Error | | `labels` | Key values associated with a change event. | No | Maximum of 200 labels (key-value pairs) per event. - Keys: Maximum of 500 characters. - Values: Maximum of 5,000 characters. | No | Error | | `payload_json` | Payload associated with a change event. | No | Maximum of 100,000 characters. | No | - | | `payload_object` | Payload associated with a change event, if the original event was in key-value format. | No | Maximum of 100,000 characters. | No | - | # Log limits Source: https://docs-xcor.paloaltonetworks.com/administer/limits-licensing/limits/log-limits Reference the license, log size, and label length limits that apply to log data in Palo Alto Networks Cortex XCOR. Palo Alto Networks Cortex XCOR logs have a variety of limits, depending on where your data is in the processing cycle. Your [license](/administer/limits-licensing/licensing) limits the amount of data you can write to and store within Cortex XCOR. Logs have the following size limits, which help ensure consistency and prevent issues with queries: * Individual logs exceeding 1 MB are dropped. * Label keys and values exceeding 1,024 characters are truncated to adhere to the 1,024 character limit. # Metric limits Source: https://docs-xcor.paloaltonetworks.com/administer/limits-licensing/limits/metric-limits Learn about the limits on metrics data within Palo Alto Networks Cortex XCOR. Palo Alto Networks Cortex XCOR metrics have a variety of limits, depending on where your data is in the processing cycle. Your [license](/administer/limits-licensing/licensing) limits the amount of data you can write to and store within Cortex XCOR. [Metrics quotas](/control/shaping/shape-metrics/quotas) assign specific percentages of your total persisted writes limit to pools of metrics. Use quotas to limit groups of metrics and ensure Cortex XCOR retains the highest value metrics. See [Managing invalid metrics](/investigate/querying/metrics/troubleshooting#managing-invalid-metrics) for information about debugging invalid metrics. ## Size limits Metrics have the following size limits, which help ensure consistency and prevent issues with queries: * Label names: 512 bytes * Label values: 1,024 bytes * Max number of labels: 64 labels * Total time series bytes: 4,096 bytes > [!NOTE] > > If label values exceed 1,024 bytes, Cortex XCOR shortens the label values > to accept the time series. Cortex XCOR shortens label values before validating the total time series byte length. When label values that exceed the maximum length, Cortex XCOR hashes the original value, and replaces the middle portion of the label with a hash value in this format: ```text theme={null} [Value shortened; Original=(len:1063 XXH64:aaf02cb52ed0a0fe)] ``` This strategy ensures that the original and shortened label values have the same prefix and suffix. The inserted hash value preserves uniqueness in the shortened values. The following example shows a metric with a long label value. > [accordion] Example metric with a long label value > > ```text lines theme={null} > # HELP application_exceptions_total Total count of application-level exceptions. > # TYPE application_exceptions_total counter > application_exceptions_total{exception="JDBCConnectionException",error_detail="org.hibernate.exception. > JDBCConnectionException: Error calling Driver#connect at org.hibernate.exception.internal. > SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:112) at org.hibernate.exception. > internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) > at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator. > java:111) at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection > (DriverConnectionCreator.java:38) at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator. > createConnection(BasicConnectionCreator.java:58) at org.hibernate.engine.jdbc.connections.internal. > DriverManagerConnectionProviderImpl$CheckConnectionTask.run(DriverManagerConnectionProviderImpl.java:285) > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent. > FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker > (ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor. > java:624) at java.lang.Thread.run(Thread.java:748) Caused by: com.mysql.cj.exceptions. > CJCommunicationsException: Communications link failure. The last packet sent successfully to the server > was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect. > NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl. > newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl. > newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance > (Constructor.java:423)"} 1.0 > ``` The following example shows the same metric, but with a shortened label value to allow ingestion. The hashed value indicates where Cortex XCOR shortened the label value. > [accordion] Example metric with a shortened value > > ```text lines highlight=9 theme={null} > # HELP application_exceptions_total Total count of application-level exceptions. > # TYPE application_exceptions_total counter > application_exceptions_total{exception="JDBCConnectionException",error_detail="org.hibernate.exception. > JDBCConnectionException: Error calling Driver#connect at org.hibernate.exception.internal. > SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:112) at org.hibernate.exception. > internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) at org.hibernate. > engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator. > java:111) at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator. > [Value shortened; Original=(len:1063 XXH64:aaf02cb52ed0a0fe)]makeConnection(DriverConnectionCreator.java:38) > at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator. > java:58) at org.hibernate.engine.jdbc.connections.internal. > DriverManagerConnectionProviderImpl$CheckConnectionTask.run(DriverManagerConnectionProviderImpl.java:285) > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent. > FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker > (ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor. > java:624) at java.lang.Thread.run(Thread.java:748) Caused by: com.mysql.cj.exceptions. > CJCommunicationsException: Communications link failure. The last packet sent successfully to the server > was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect. > NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl. > newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl. > newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance > (Constructor.java:423)"} 1.0 > ``` ## Late-arriving metrics Prometheus, OpenTelemetry, and other metric formats include one or more timestamp values for each data point. These values indicate when a sample was observed, or represent the time range of the data point. Cortex XCOR can accept late-arriving data points within a time frame, depending whether the data point matches an aggregation rule or is ingested without aggregation: * Aggregation rules accept data points from two minutes to eight minutes past the current ingestion time. * Raw data points can be written to the database up to two hours before the ingestion timestamp. ## Future-arriving metrics Cortex XCOR accepts incoming metrics one minute ahead of the current timestamp. If metrics arrive outside of this one-minute buffer, Cortex XCOR rejects those metrics and returns an error indicating that metrics arrived too far into the future. # Query limits Source: https://docs-xcor.paloaltonetworks.com/administer/limits-licensing/limits/query-limits Learn about query limits in Cortex XCOR, what happens when you hit limits, and how to avoid hitting limits. Query resources are finite in any given system. Resource demand grows based on factors such as the source of, and the amount of data the query retrieves. Any very large query can request enough resources at either the database or browser level that it leaves few resources for other queries, causing them to time out waiting for resources to become available. Palo Alto Networks Cortex XCOR employs several query limits at both the [browser level](#query-truncation-at-the-browser) and the [database level](#query-protections-in-the-database) to ensure a consistent user experience across the system in response to current query demand. Queries can come from one of two [query sources](#query-sources). ## Query sources In Cortex XCOR, query demand comes from either an *automated* or a *manual* source: *Automated sources*, such as [monitors](/investigate/alerts/monitors) and [recording rules](/control/shaping/shape-metrics/rules/recording) with regular evaluation intervals, produce a relatively predictable demand on the query resources at the database and at the browser. Queries from an automated source often request a smaller set of data than something like a dashboard query, but might incur high request volume. Although each individual query is small, the amount of query resources they're demanding at regular intervals is very large. *Manual sources*, such as loading a dashboard, running a query in Metrics Explorer, or making a direct API call, place demands on query resources at both the database and browser that are cyclical or spiky. Queries from a manual source are often exploratory, or retrieve longer time periods than automated queries. The load these queries place on the system varies significantly with the scale of data returned. Queries requesting more time series and data points require more resources to retrieve information from the database, and also can require more resources to deliver that information to the browser. Individual queries of either type demand different query resources depending on the amount of data retrieved from the database, amount of data returned the browser, or both. For example: * A query that places high load on the database but low load on the browser might request the sum of a large set of data. The query retrieves all relevant data points from the database (high database query load), but only returns a few summed data points to the browser for a system's performance monitoring workflow. * A query that places high load on both the database and browser might request the raw, unaggregated data points from all services (many unique time series) to return to the browser, such as for a debugging workflow. ### Automated source query limits Cortex XCOR includes the [Metrics Query Capacity Overview](/observe/dashboards/managed-dashboards#metrics-query-capacity-overview) dashboard to measure your automated query consumption against system capacity. Use this dashboard to understand how much query capacity remains as part of your budget. The dashboard includes queries from monitors, recording rules, and service accounts in the reporting metrics. Cortex XCOR uses [selectors per second](#selectors-per-second) and [data reads per second](#data-reads-per-second) metrics to track automated source query limits. Exceeding either of these limits results in dropping data with an HTTP `429 Too Many Requests` status code. Cortex XCOR continues dropping an indiscriminate subset of incoming queries to keep query traffic within defined limits. To guard against prematurely dropping queries when unforeseen spikes occur, Cortex XCOR doesn't start dropping data until either of the query limits are exceeded for 10 minutes consecutively. #### Selectors per second These metrics track the count of selectors that queries issue per second. For example, this metric includes a single selector named `up`: ```text theme={null} up{app="webserver"} ``` A more complex query might include multiple selectors. The following query includes two `sum` selectors: ```text wrap theme={null} sum(rate(http_server_handled_total{status="200"}[2m]) / sum(rate(http_server_handled_total[2m])) ``` The Metrics Query Capacity dashboard displays the number of selectors consumed and dropped against the limit per second. For more information about selectors, see the [Prometheus documentation](https://prometheus.io/docs/prometheus/latest/querying/basics/#time-series-selectors). > [!NOTE] > > The selectors per second query limit can't be increased. To reduce query load for selectors per second, use the following strategies: * Configure longer intervals for [monitors](/investigate/alerts/monitors) and [recording rules](/control/shaping/shape-metrics/rules/recording). For example, consider 1,000 monitor queries that include a single selector, each of which runs every 15 seconds. These figures calculate to roughly 66 selectors per second (`1000/15`). Increasing the execution interval to 60 seconds reduces the number of selectors per second to roughly 16 (`1000/60`). * Structure alert and monitor queries to use PromQL aggregations for optimal efficiency. For example, you might create two separate alerts for service A and service B error rates: ```text theme={null} sum(rate(http_server_handled_total{service="A". status=~"5.*"}[1m])) > 10 sum(rate(http_server_handled_total{service="B". status=~"5.*"}[1m])) > 10 ``` Instead, create a single monitor that checks both services: ```text wrap theme={null} sum(rate(http_server_handled_total{service=~"A|B". status=~"5.*"}[1m])) by (service) > 10 ``` #### Data reads per second These metrics track the amount of raw data that Cortex XCOR fetched to run the specified queries per second. Cortex XCOR calculates data consumed by a query with this calculation: ```text /DATAPOINTS_RETURNED_FOR_SERIES/ theme={null} READS = sum(DATAPOINTS_RETURNED_FOR_SERIES) ``` * `DATAPOINTS_RETURNED_FOR_SERIES` is the number of data points retrieved for query execution. This equation calculates the sum of all data points for a series, with a minimum of 60 data points per series. All smaller values are rounded up to `60`. Consider a range query `sum(up{app="webserver"})` with a time range of `[now()-1h, now()]`. If the query selects 10 steady series with a scrape interval of 30 seconds, the total number of retrieved data points is 1,200, as defined by this equation: ```text theme={null} READS = 10 * (1h/30s) ``` Next, consider an instant query `up{app="database"}` that selects 20 time series with a scrape interval of one minute. Prometheus fetches five minutes of data by default, so the resulting number of fetched data points is `100`, as defined by the following equation. However, this equation doesn't apply the minimum number of data points retrieved per series, which is 60, so this equation isn't correct. ```text theme={null} 20 * 5 = 100 ``` After applying the minimum number of data points retrieved per series, this rule actually consumes 1,200 reads, as defined by this equation: ```text theme={null} 20 time series * 60 data points retrieved = 1200 reads ``` The following instant query is more advanced. This query requires Cortex XCOR to fetch all data points for the selected series in a 30-day period, and apply the minimum number (`60`) of data points retrieved per series. ```text theme={null} sum_over_time(job_execution_errors[30d]) ``` Queries that fetch [downsampled data](/control/shaping/shape-metrics/downsampling) will consume less data reads because datapoint resolution for the selected series is reduced, meaning less data points are used to process the query. To reduce the consumption of data reads per second, use the following strategies: * Write queries with a shorter time range or shorter range selectors. * Create [rollup rules](/control/shaping/shape-metrics/rules/rollup) for unnecessary labels in your most expensive queries to reduce the amount of data points the query needs to fetch. * Ensure that query selectors are as precise as possible, especially in join queries. For example, consider this query: ```text wrap theme={null} sum(rate(container_cpu_seconds{cluster="prod"}[1m]) by (node, container) / on (node) node_cpu_capacity ``` Including `{cluster="prod"}` in the latter part of the query reduces the number of series and in turn data points the query needs to fetch for the right side of the join. Use this instead: ```text wrap theme={null} sum(rate(container_cpu_seconds{cluster="prod"}[1m]) by (node, container) / on (node) node_cpu_capacity{cluster="prod"} ``` ## Optimize queries Large queries might be good candidates for optimization by decreasing the amount of data the query is trying to retrieve. Use the [Metrics Query Capacity Overview](/observe/dashboards/managed-dashboards#metrics-query-capacity-overview) to identify large queries. Optimize queries by: * Shortening the time window, or using [rollup rules](/control/shaping/shape-metrics/rules/rollup) to decrease the data scale. * Improving the query syntax by removing regular expressions to reduce the index lookups performed by the query. * Adjusting the number of concurrent unique requests in the system. ## Log query rate limits When [querying log data](/investigate/querying/query-logs), be mindful of the following limits that can impact your search experience, what happens if your tenant exceeds limits, and how you can avoid hitting these limits. * **Global query limit**: Each Cortex XCOR tenant has a global limit on the total compute resources available for queries. If this limit is reached, queries are queued and will run as soon as resources become available. * **User query limit**: This limit prevents a single person from consuming all available query resources. The user query limit is calculated based on the compute resources required to run individual queries in addition to the number of user queries that are run. Each user is limited to a percentage of the total available query resources. * **API query limit**: API queries are limited to a percentage of the total available query resources. ### Avoid log query rate limits If you experience slow or lagging queries on your log data, implement the following changes to help increase the speed of your queries: * Close unneeded tabs in your browser. Open tabs with long-running queries or that refresh often, such as in Logs Explorer or in dashboards, consume more resources. * Write efficient queries. Ensure your log queries are efficient so that they complete faster and make resources available for other queries to run. * Include the primary key in your query: Query on one of the predefined [keys](/investigate/querying/query-logs/query-syntax#keys), such as `service` or `severity`, and then use the [query syntax](/investigate/querying/query-logs/query-syntax) to incorporate additional attributes. * Narrow the query scope. Reduce the time range or scope of your query to return results faster. ## Query truncation at the browser Cortex XCOR can truncate queries that return many unique time series or data points to the browser to reduce the chances of long load times and query timeouts. Truncating queries protects the browser from crashing when querying many metrics. Dashboards and the Metrics Explorer both use query truncation. Cortex XCOR calculates the browser limit using a combination of time series, time granularity, and time period (and their resulting data points) requested by the query. The limits are: * Time series a query can return to the browser: 2,500 * Data points a query can return to the browser: 300,000 The number of time series and data points returned to the browser might be the same as the number requested from the database. If the query is doing some level of aggregation, the number of time series and data points returned might be fewer than what the query requests, but not greater. To reduce the number of series returned to the browser, view the [Aggregation Rules UI](/control/shaping/shape-metrics/reduce-cardinality/aggregation-rules) to determine if a queryable aggregate metric already exists. If an aggregate metric doesn't exist, use [aggregation rules](/control/shaping/shape-metrics/rules) or [derived metrics](/investigate/querying/metrics/derived-telemetry/derived-metrics) to: * Query an aggregated subset of the raw data. * Break the query into smaller chunks (by time, for instance) to reduce returned data points. ### Enable or disable query truncation By default, Cortex XCOR enables query truncation. To disable or re-enable query truncation: 1. In the displayed dialog, select **Options**. 2. Click the **Truncate expensive query results** toggle. 3. Click **Done**. > [!NOTE] > > Disabling query truncation causes expensive queries to take longer to load and can > result in timeouts (no results returned for a single query), or might cause the > browser to crash. ![The Options dialog with the Truncate expensive query results toggle.](https://mintcdn.com/chronosphere-74b1ef6e/uC14UswLa-z86Y3z/public/doc-assets/20240110-query-truncation-options.png?fit=max\&auto=format\&n=uC14UswLa-z86Y3z\&q=85\&s=2dccee5cb00af7dfb1b8ba3ed29afb30) ## Query protections in the database Cortex XCOR employs protections against very large queries in the database layer, in addition to the browser. A query that requests many unique time series or data points from the database can experience these situations: * Per-query scale protections * Across-query resource balancing protections * Individual query timeouts These protections ensure a positive user experience for the maximum number of users. A query requests resources from the database until it has the data it needs, or until resources run out. Available resources can run out due to these reasons: * Individual query scale protections are in place. * There are many queries sharing scarce query resources (query balancing). * An individual query reached a timeout. ### Query scale protections Query scale protections ensure a positive user experience for the maximum number of users. Current database query scale protections are: * [Time series](https://prometheus.io/docs/concepts/data_model/#notation) a query can retrieve: 300,000 * Standard data points a query can retrieve: 200,000,000 > [!NOTE] > > For Cortex XCOR > [histograms](/investigate/querying/promql/apply-functions#querying-histogram-metric-types), > the query limit depends on the number of buckets containing data within a > histogram. The data points needed to satisfy the query's time requirement are calculated as: ```text wrap theme={null} (Number of requested time series) * (Data resolution of the requested time series) ``` For example, a query does a sum of data points over two minutes, storing the requested data with a 10-second resolution. That sum operation requires 12 data points per time series, calculated as: ```text theme={null} 60s + 60s = 120s; 120s/10s resolution = 12 data points ``` If the query requests 20,000 time series, the number of data points is 240,000, calculated as: ```text wrap theme={null} 20,000 time series * 12 data points per series for the 2 minute window ``` Dashboard queries request more data points because they use longer ranges. If the previous example query is a dashboard query and the dashboard window is set to the past one hour, the data points retrieved are calculated as: ```text theme={null} 60 minutes / 2 minute sum interval = 30 intervals 30 * 240,000 = 7,200,000 data points ``` Individual queries requesting more than the allowable limits will time out. Exceeding query scale limits can produce one of the following error messages: ```text theme={null} query processing would load too many samples into memory in decoding ``` ```text theme={null} The query exceeded the allowable resource limit. ``` These errors indicate that the query is trying to retrieve too many resources. Modify the impacted query to reduce the scope and reduce the number of results being fetched. ### Query resource balancing Cortex XCOR tracks the number of concurrent queries received, the scale of each query, and the unique users for each query. Cortex XCOR makes an effort to fairly balance the available query resources between large and small queries, and also between unique users. If there are many concurrent queries, and each with relatively high scale, some queries might need to complete in stages. This means that some queries must wait (be throttled) to allow queries from other unique users to make use of the available resources. The more unique users, the more balanced the system is in enabling different queries to complete. ### Query timeouts Even with balancing measures in place, if there are insufficient resources for a query to complete within a specified time period, the query will time out. Cortex XCOR displays an error message indicating the query timed out. If a query times out, try these methods to resolve the issue: * Modify the query syntax to retrieve less data per query. For example, try to shorten the time range. * Use shaping rules such as [aggregation rules](/control/shaping/shape-metrics/rules) to downsample or roll up unnecessary labels, and then modify the query to retrieve aggregated data points instead of the raw data points. # Tracing ingest limits Source: https://docs-xcor.paloaltonetworks.com/administer/limits-licensing/limits/trace-limits Reference the tag, span, and trace ingest limits for tracing data in Palo Alto Networks Cortex XCOR. Palo Alto Networks Cortex XCOR uses the following ingest limits for tracing data. If you exceed one or more of these limits, Cortex XCOR truncates or rejects the data depending on the limit itself. Exceeding a limit indicates that you might need to modify your client-side instrumentation, or implement head or tail [sampling rules](/control/shaping/sample-traces) to drop data that you don't want to persist. The following limits are in increasing order of granularity from most granular to most broad. ## Invalid tags Cortex XCOR limits the size of a tag to 200 bytes for any span. Cortex XCOR accepts and processes the first 200 bytes and truncates any additional bytes. The related span and trace aren't otherwise impacted by this limit. ## Invalid spans If the start time of a span is greater than 10 minutes before or after the current time, Cortex XCOR marks the span as invalid and drops it. The parent trace isn't impacted, provided that the other spans in the trace have valid start times. ## Invalid traces Cortex XCOR persists individual traces with 100,000 spans or fewer. If a trace has more than 100,000 spans, Cortex XCOR rejects the trace and all included spans. Although Cortex XCOR rejects invalid tracing data, you can view rejected data in Trace Optimization, or by querying the `chrono_trace_dropped_volume_in_bytes_count` metric. You can also [create a monitor](/investigate/alerts/monitors#create-a-monitor) for this metric and generate notifications when tracing data is rejected. The following query returns invalid trace data by reason, such as when a span is too far in the past: ```shell theme={null} sum(rate(chrono_trace_dropped_volume_in_bytes_count[5m])) by (reason) > 0 ``` ## Pod limits Cortex XCOR limits data ingest to 2 GB per minute for each Kubernetes pod that handles data ingest. Cortex XCOR scales these pods automatically to handle current traffic, and imposes this limit to protect against sudden traffic surges to a single pod. Your tenant might have anywhere from two to 100 pods at any given time, depending on current load. The total ingest limit in one minute depends on the number of pods in use times the 2 GB per minute for each pod. ## System limits Cortex XCOR scales as rapidly as possible to manage sudden changes in trace data volume. However, sudden spikes might trigger surge protections that drop trace data until more resources are available. This system limit allows the majority of normally observed data fluctuation patterns and guarantees the reliability of the Cortex XCOR trace ingestion pipeline in the case of unexpected volume changes. Trace data volume exceeding this limit is visible in Trace Optimization as a metric tracking volume of traces dropped due to limiting. # Manage service configuration Source: https://docs-xcor.paloaltonetworks.com/administer/service-discovery Discover and configure services in Palo Alto Networks Cortex XCOR. > [!NOTE] > > This feature isn't available to all Palo Alto Networks Cortex XCOR users and > might not be visible in your app. For information about enabling this feature in your > environment, contact [Cortex XCOR Support](/support). The **Services** page provides a view into your applications based on [services](/observe/services). If a service doesn't match the rules that you define, you can edit the service configuration in Palo Alto Networks Cortex XCOR to include or remove services from your display. You can also modify services' visual presentations of your data. For setup instructions, see [Configure services](/observe/services/configure-services). ## Understand service configuration The **Service Configuration** page lets you configure how to discover services that exist in your environment, and what visualizations to present on your services pages, based on their telemetry data. All users can view service configurations and preview changes. Only users with [SysAdmin permissions](/administer/accounts-teams/teams#add-a-role-to-a-team) can save new or edit existing service configurations. ```mermaid actions={false} theme={null} graph LR PM[Service pod mapping] --> DJ["Discovery jobs"] DJ --> MR["Merge rules"] MR --> Prev["Preview"] Prev --> Present["Presentations"] ``` ## View service configuration In the navigation menu, click ** Go to admin view** and then select **Platform > Service Configuration** to open the **Service Configuration** page. ### Review changes If there are unsaved changes, the **Review & apply changes** button indicates the number of unsaved changes. An alert icon indicates modified jobs that haven't yet been saved. ### Global mappings Global mappings let services be discovered by jobs using metrics that have a Kubernetes Pod or instance label but no obvious service labels. Discovery jobs can be configured to join their [Pod](https://kubernetes.io/docs/concepts/workloads/pods/) label with the pod label from one of the global mapping configurations that has a label that's more likely to map to a service name. For example, the `kube_pod_info` metric from [kube-state-metrics (KSM)](https://github.com/kubernetes/kube-state-metrics) have a `created_by_name` which is often a service name. Cortex XCOR uses those labels to match the physical pods to a discovered service. Users can't edit configurations in the **Global mapping** tab. These configurations are commonly from standard KSM and OpenTelemetry libraries. Introducing new potentially conflicting configurations here could cause services to be silently ignored by discovery jobs. * **Slug**: The slug name of the discovery rule defining the service pod mapping. * **Name**: The rule name. * **Service labels**: One or more labels that could be a candidate for the service name. * **Pod label**: The pod label is usually the name of the pod or instance and is used as a key to map to the service name. These are created during [metrics discovery jobs](#use-discovery-jobs-to-identify-and-add-services). Click the three vertical dots icon and then **Open in Metrics Explorer** to open the query for that service instance in [Metrics Explorer](/investigate/querying/metrics/explorer). ### Configuration status The **Configuration Status** tab title includes the number of changes since the last run of a discovery job. If there are problems with discovery jobs, the tab includes an orange dot in the corner. Click the tab to review all messages. Use the search box to find specific messages. Each message contains the following details: * **Severity**: The severity of the alert. * **Type**: The type of process causing the error. For example, type of `discovery job` means a [discovery job](#use-discovery-jobs-to-identify-and-add-services) has errors or conflicts that need correction. * **Name**: The name of the item in the **Type** field. * **Message**: Details about the error or conflict. Use these details to review your configuration and make changes. * **Labels**: A list of labels and values that explain the conflicting rule: * `service_name`: The service with the conflict. * `first_service_name`: The first instance of a service with the label causing the conflict. * `rule_slug`: The immutable ID of the rule for this discovery job. * `source`: The label whose value causes the conflict. * `dimension_value`: The value of the conflicting label. ## Use discovery jobs to identify and add services *Discovery jobs* are templates that match metrics to a discovered service. Cortex XCOR provides some common discovery jobs. Create your own jobs or copy and customize existing jobs for your environment. Use the **Search jobs** box to find a specific template. * **Status**: Toggle the switch to enable or disable the job. * **Managed by**: Jobs are manged by Cortex XCOR (non-editable), or by the user (editable). * **Job name**: The user-readable discovery job name. * **Type**: Users can create jobs to discover services based on metrics (`Metrics`) or change events (`Events`) types. `Traces` are managed by Cortex XCOR and not user creatable or editable. `Traces` is used by the **Trace Services Based on Service Attribute** job, and is available only to customers with a Tracing license. Users can enable or disable the discovery job. * **Service label mapping**: Labels identifying the service name. Provided by the the service label or instance label + identifying label (**Service template label**) from the template form. * **Services discovered**: The estimated maximum number of discovered services. This number can be significantly different (often higher) than the actual number of discovered services, depending on [merge rules](#use-merge-rules-to-correct-or-remove-services). ### Create a discovery job To create a discovery job: 1. On the **Service Configuration** page, click **Create**. 2. From the menu, choose **Metrics discovery** or **Change events discovery**. 3. Add a **Job name**. 4. Select **Manual** or **From dashboard JSON**. 5. Add **Job details**: > [tab] Metrics > > For a **Metrics discovery job**, add: > > * **Metric name**: Cortex XCOR queries this metric to find labels > which contain candidate service names based on the discovery job configuration. > * **Metric name prefix**: A prefix of metric names to used filter and scope > metrics this job applies to. This field uses > [glob syntax](/investigate/querying/glob-syntax) to match metric names. > When a service is discovered by this discovery job, metrics with this prefix > will receive a [derived > label](/investigate/querying/metrics/derived-telemetry/derived-labels) called > `lens_service` which is set to the discovered service name. > > > [!WARNING] > > > > This prefix, along with optional target label names in this job, must not > > conflict with the prefix in another enabled discovery job. > * Optional: Click **Options** to add one or more **Target names** and **Target values**. > These fields are respectively a label name and value > [glob expression](/investigate/querying/glob-syntax) that further scope to > which metrics Cortex XCOR applies the `lens_service` label. Use > these fields to help scope the discovery job and avoid conflicts when you > need to configure different discoveries on metrics with the same prefix. > * **Service mapping**: > > Focus your template using one of the following groups: > > * **Service label**: A label containing the service name. This label must be > found on the previously specified **Metric name**. This is the preferred > option when you already have a good service name label on your metrics. > Click the Click the icon to draft a > `cardinality_estimate by () ()` query in > [Metrics Explorer](/investigate/querying/metrics/explorer). > * **Pod mapping**: Pod mappings are an advanced option. Use if you don't have > an obvious label to use as the service name, but you have a pod or instance > label that could join with a global mapping that has a service name. > * **Instance label**: The label containing the instance or pod name. Label > values are used as keys to map to the service name. For example, GRPC > metrics have an **instance label** of `instance` and an identifying label > of `grpc_service`. > * **Transform regex**: A [regular > expression](/investigate/querying/regular-expressions) that modifies the > value in the instance label to match a value in the service instance > mappings. This is often used to remove a pod name's prefix. Can be `(+.)` > if no trimming is required. > * **Transform replacement**: The regular expression replacing the > original label, allowing modification of the value in the instance label > so that it matches a value in the service instance mappings. You can use > symbols like `$1` to insert regular expression capture groups. > * **Identifying label**: A label containing information that uniquely > identifies which service the time series belongs to. The identifying label > can't be the `instance label` or other ephemeral label. It must be static, > finite, and uniquely identify the service. For example, an identifying > label value of `X` that indicates it belongs to `service1` must always > map to `service1`. The value `X` can't map to another service. > > > [!WARNING] > > > > This mode of service discovery fails if this label is > > [high cardinality](/control/shaping/shape-metrics/reduce-cardinality). > [tab] Events > > For an **Events discovery job**, add a **Service label**, which is the label > containing a the service name. Discovery jobs use this to find service name > candidates. > > Use the **Preview events** graph to select a service and preview the events to show. > > For example, if you're sending an event to Cortex XCOR with the payload > `"pipelineName": "PIPELINE_NAME"` as a label, you can search through the service > labels to find and select that label. If the event doesn't have the `lens_service` > label, you can create a [merge rule](#use-merge-rules-to-correct-or-remove-services) > to map the existing label to the service. Events corresponding to that label > display in charts on the applicable service's page. > [tab] From a dashboard > > You can create both a presentation and a metrics discovery job from a dashboard. > > 1. Click **Import JSON file** to import a Cortex XCOR standard dashboard > from its [JSON representation](/tooling/api-info/dashboard_schema). This > feature isn't compatible with classic dashboards. > 2. Optional: Click **Select dashboard** to automatically generate the JSON representation > for an existing dashboard. > > If the JSON is valid, Cortex XCOR confirms this. > 3. If the dashboard is confirmed to be valid, click the **Choose service variable** > dropdown that appears and select an appropriate variable. To complete discovery job completion: 1. Click **Create**. 2. Click **Review & apply changes**. ### Edit or delete a discovery job You can edit or disable existing user-created jobs to ensure your configurations match your services when those services change. 1. Click the three vertical dots and then select **Edit config** to change or **Delete** to remove the job. 2. Available edits to job details include: * Clear the **Enabled** checkbox to disable the job. * Update the **Service label**. * For metrics discovery, update the **Pod mapping** fields. 3. Click **Stage changes** to preview your updated configuration. 4. Review your changes. 5. Click **Review & apply changes** to save. When editing a metrics discovery job, you can review the **Service discovery query**, which is the query used to generate the discovery job. Click the icon to open the query in [Metrics Explorer](/investigate/querying/metrics/explorer). ## Use merge rules to correct or remove services When a service doesn't match expectations, create *merge rules* to correct mismatches. Merge rules define how to group or match service data when service names or labels might not be the same across multiple instances. Merge rules affect the number of displayed services in service pages. For example, Trace Explorer might find a particular set of services, but a service page might have a lower number of services based on the merge rules applied to those services. Use the **Search rules** box to find a specific rule, or filter by **Rule type**. The **Merge rules** table displays information that was set during rule creation. Merge rules apply from the top to the bottom of the list, in **Order**. A service matches the first rule that applies to it, and won't match additional rules. Use the drag icon to move the rule up or down in the list to change the order that rules apply. Toggle the **Status** icon to disable a job. ### Preview and apply changes This table is a list of changes that will take effect when you apply any staged merge rule updates. To display only the staged changes, click the **Show diff only** toggle. If **Review & apply updates** displays a **0** in the button, no user-created changes are staged to apply. However, the preview pane can still display staged changes. These changes are due to discovery jobs run by Cortex XCOR that haven't yet been applied. #### Add or modify services To run discovery jobs: 1. Click **Review & apply changes** to open a larger **Review & apply changes** drawer. This drawer lets you review a more detailed preview, including any **Presentations** attached to services. Click the **Use freshest data** toggle to run the preview without a cache from previous discovery runs. 2. Click **Run service discovery**. You must have [SysAdmin](/administer/accounts-teams/teams#add-a-role-to-a-team) permissions to run service discovery. In the **Review & apply changes** drawer, the number of unchanged, added, deactivated, and modified services displays under the drawer title. Select **Skip service discovery** to wait until the next schedules discovery run. To discard changes, click **Reset changes**. ### Create a merge rule > [!NOTE] > > You can merge a limited number of service names together. Merge rules can be > used to group service names like `gateway` and `gateway-staging` together. They can't > merge high cardinality service names together like `gateway-1` and `gateway-2` to > `gateway-n`. > > It's always better to have a service label that already uses the correct service > name rather than using merge rules to fix them afterwards. Merge rules use > [regular expressions](/investigate/querying/regular-expressions). To create a merge rule: 1. In the **Merge rules** tab of **Service Configuration**, click **Create** and then select a rule type: * **Ignore** rules remove matching services from the interface, stop data collection for them, and prevent discovery from adding new services that match this rule. * **Merge** rules group services together. * **Suppress**: Use this to prevent noisy service discovery jobs from creating too many ephemeral services in your environment. Adding a **Suppress** rule for a given **Suppressed Discovery Slug** means that this discovery job won't discover new services. If a service is discovered by another discovery job, presentations configured to display for the suppressed discovery job will display. 2. Add the following fields: * **Rule Description**: Describe what this service rule does. Displays on the configuration page as **Description**. 3. The following fields display based on your rule type: * **General Settings**: The **Rule description**. * **Rule details**: The following fields display in the **Details** section of the **Merge rules** page. * **Source labels**: Specify which label's values the rules apply to. The `Discovered service name` is a source label, and is most commonly selected. * **Regex**: Add a new regular expression to replace the original. On the service configuration page, the original **Regex** displays, along with the **Replacement**, which is the value added here. * **Suppressed Discovery Slug**: When using a **Suppress** rule, add a discovery slug to suppress new services from being generated by that discovery. * **Global Suppression Exceptions**: When using a **Suppress** rule, don't suppress the listed services, even if they're generated by suppressed discoveries. 4. Click **Stage changes**. The **Service configuration** page displays, with your updates displayed. 5. The **Preview** updates. Preview your changes using the table. The **Service name** and **Discovery jobs** included in that service show what metrics are merged into a given service name. Services and metrics being removed from display have a **`[-]`** before them. 6. Click **Review & apply changes**. #### Remove a service or prevent service creation You can deactivate a service by removing the discovery rule that identifies it. Cortex XCOR doesn't display an inactive service on the **Services** page and no data is collected for it. To deactivate specific services, or to prevent new services from being created that match certain criteria, create a narrowly defined [ignore merge rule](#create-a-merge-rule) that matches the unwanted service. For example, you can use ignore merge rules to remove services that lack data from view. Such services persist as inactive services. You can force the **Services** page to display them by enabling the page's **Include inactive services** toggle. The page of an inactive service also displays a banner indicating its inactive state. ### Edit or delete a rule To edit or delete a service rule: 1. Click the three vertical dots icon. 2. Click **Edit rule** to change the rule, or **Delete** to remove the rule. 3. Edit the fields, per their descriptions in the [create rules](#create-a-merge-rule) section. 4. Click **Stage changes**. The **Service discovery preview** displays your updates. 5. Click **Apply changes** to save or **Reset changes** to cancel. ## Presentations Presentations are templates for how service data displays. Cortex XCOR provides default presentations for your use. You can also create your own custom presentations. ### View presentations To review existing presentations, on the **Service Configuration** page, click **Presentations**. All of your presentations display as cards separated into the following groups: * **Cortex XCOR Managed**: Default presentations, which can't be edited. * **Custom Presentations**: Editable presentations created by users. Each card displays the following information: * **Name**: The presentation name. * Enabled status: Either `Enabled` or `Disabled`. * **Number of Services**: The number of services this presentation represents. * **Number of panels**: The number of dashboard panels this presentation displays. ### Create a presentation You can create custom presentations for your services. Presentations can use any panel type that a [Cortex XCOR dashboard](/observe/dashboards/panels) can use. To create a presentation: 1. In the **Presentations** page, click **Create**. 2. Add a **Name** and **Description** to identify the presentation. 3. Create conditions the presentation must meet. In the **IF service has** menu, select a discovery job. The presentation will show on services that have been discovered by this discovery job. 4. Click **+ Add condition** to **show** more services, or to **hide** specific services from this presentation. 5. Review the list of services that match the selected conditions. Make changes to the conditions if needed. 6. The **Review Content** section of the creation page defines how the content displays on the [service page](/observe/services/service-pages). 7. Click **Start with existing dashboard** if you already have a dashboard created to use. Click **Start a new view** to create a new dashboard, which opens the dashboard editor in a new tab. #### Use an existing dashboard If you have a dashboard for an existing service, and you're creating a service presentation, you can select the service as a variable. Cortex XCOR replaces that variable in the JSON with `lens_service` to make the presentation flexible for all services, which lets you reuse this presentation for multiple services. To import an existing dashboard: 1. Click **Start with existing dashboard**. 2. Select a [dashboard](/observe/dashboards) from the list. 3. Click **Save** when finished. 4. Click **Review & apply changes**. #### Start a new view If you select **Start a new view**, the dashboard editor opens in a new tab. 1. Add [panels](/observe/dashboards/panels) and [variables](/observe/dashboards#create-and-configure-dashboard-variables) to your new dashboard. 2. Click **Save** when finished. 3. Click **Save** in the **Create** screen. 4. Click **Review & apply changes**. ### Edit a presentation To change an existing presentation: 1. On the **Service Configuration** page, click the three vertical dots and then select **Edit presentation**, or on the **Presentations** page, click the card for the service. 2. Make changes to your presentation. You can modify the presentation's **Name** and **Description**, amd **Edit Conditions**. You can also **Review services which match the conditions**. 3. Click **Save**. ### Delete a presentation To delete a presentation: 1. [Edit the presentation](#edit-a-presentation). 2. Click **Delete presentation**. 3. Click **Delete** to confirm that you want to delete the presentation. ## Create SLOs from discovery jobs After discovery finds and displays services, you can create [service level objectives](/observe/slo) (SLOs) tied to a metrics discovery job from **Service Configuration**. ### Edit SLO config To create availability or latency SLOs for a metrics discovery job: 1. On the **Service Configuration** page, on the **Discovery jobs** tab, click **See more actions** () on a metrics discovery job row, and then select **Edit SLO config**. 2. Configure the SLO using the same fields described in [Define an SLO](/investigate/alerts/manage-slos#define-an-slo). 3. Click **Save**. **Edit SLO config** appears only for metrics discovery jobs, not event discovery jobs. For the queryless RPC and gRPC builder and other creation paths, see [Create a new SLO](/investigate/alerts/manage-slos#create-a-new-slo). # Cortex XCOR compliance information Source: https://docs-xcor.paloaltonetworks.com/compliance Information about Cortex XCOR compliance standards Palo Alto Networks Cortex XCOR is SOC 2 Type 2 and ISO 27001 audited. To request our report, reach out to your assigned account manager, or contact [Cortex XCOR Support](/support). For more information about Cortex XCOR security, see the [Security overview](https://chronosphere.io/security-overview/). # Optimize your telemetry data Source: https://docs-xcor.paloaltonetworks.com/control Learn about how to optimize your telemetry data with Palo Alto Networks Cortex XCOR. Your app generates a lot of data, but not all of it's actionable. Storing every byte is costly, and can quickly overwhelm your capacity limit, license limit, or both. Aside from financial cost, there's computing cost associated with generating, processing, and temporarily storing your telemetry data. Reducing telemetry data volume keeps costs predictable and manageable as your business scales, and helps teams manage their data effectively by reducing the amount of available information. When you optimize your telemetry data, on-call engineers can find the data they need to solve problems faster. To take control of your telemetry data, Palo Alto Networks Cortex XCOR provides multiple tools you can use to identify and eliminate data that isn't used and doesn't deliver value to your business. See [Data optimization concepts](/control/storage) to learn about the mechanisms you can use to control your telemetry data. The following diagram shows how the stages of the control workflow connect, and each stage links to its section on this page. The workflow is a loop rather than a one-time setup, because partitions and budgets reveal what your data consumes, which sends you back to your shaping rules. For a guide that defines this workflow, including how to set thresholds that alert or drop data, see [Manage telemetry data budgets](/overview/guides/manage-budgets). ```mermaid actions={false} theme={null} flowchart LR Send["Send data"] subgraph OP["Cortex XCOR"] Reduce["Reduce"] Shape["Shape"] Review["Review"] Partition["Partition"] Analyze["Analyze"] Budget["Budget"] end Send --> Reduce --> Shape --> Review --> Partition --> Analyze --> Budget --> Shape click Reduce "#reduce-volume" click Shape "#shape-and-sample-your-data" click Review "#review-rules" click Partition "#create-partitions" click Budget "#create-budgets" click Analyze "#analyze-consumption" classDef rules fill:#007A3D,stroke:#000,stroke-width:2px,color:#FFFFFF; class Reduce,Shape,Review,Partition,Budget,Analyze rules ``` ## Reduce volume After sending data to Cortex XCOR, use the [Live Telemetry Analyzer](/investigate/analyze/telemetry-analyzer) to identify opportunities to reduce the overall volume of telemetry data. If you're sending Prometheus metrics, you can also use the [Telemetry Usage Analyzer](/investigate/analyze/usage) to identify obsolete or unnecessary data, and understand the impact of a proposed shaping rule to users of that data. ## Shape and sample your data Use the Cortex XCOR Control Plane to [shape and sample your telemetry data](/control/shaping) and reduce the amount of data you persist. After implementing partitions and budgets to manage consumption, you can revisit optimization rules to transform, reshape, retain, or exclude telemetry data. ## Review rules After creating shaping rules, use the various tools that Cortex XCOR provides to [review the impact](/control/shaping/review-impact). If your shaping rules reduced too much data or not enough, make changes to ensure the rules achieve the intended outcome. ## Create partitions To help [manage telemetry data consumption](/control/consumption), create *partitions*, which are slices of your data with distinct owners. Partitions provide a consistent structure for attributing usage and costs to the appropriate owners in your organization so they can isolate and control independent their parts of the business. ## Analyze consumption After defining partitions, use the [Consumption page](/control/consumption/analyze) to view persisted log data consumption against license capacity. This page helps to detect unwanted spikes and understand what's driving growth across your telemetry data. Use this information to [review shaping rules](#review-rules) and make changes that impact your budgets. Manage license consumption by [reviewing licensing dashboards](/observe/dashboards/managed-dashboards#licensing-dashboards) to identify usage trends and avoid exceeding your organization's licensing limits. [Understand telemetry data limits](/administer/limits-licensing) for each telemetry type to ensure a performant experience when ingesting, querying, and creating resources. ## Create budgets After creating partitions and analyzing consumption, create and apply *budgets*, which are shaping policies you assign to a partition to safeguard against runaway usage and overspending. [Budgets](/control/consumption/budgeting) help track and manage growth to ensure your license consumption remains predictable. # Manage consumption Source: https://docs-xcor.paloaltonetworks.com/control/consumption Learn how to create partitions and budgets for your telemetry data in Palo Alto Networks Cortex XCOR and control the data you keep. Telemetry data provides your teams with more detailed context to help identify and fix the root causes of issues. However, not all telemetry data provides the same utility, and you don't want to consume a portion of your license with unnecessary data. To help control data usage, first create [*partitions*](/control/consumption/partitions), which are slices of your log data with distinct owners. For example, you can create partitions for individual services, teams, and environments to provide a consistent structure for attributing usage and costs to the proper owners. Partitions let you apply [*budgets*](/control/consumption/budgeting), which are shaping policies you can assign to a partition to safeguard against runaway usage and overspending. After defining partitions, use the [Consumption page](/control/consumption/analyze) to view persisted log data consumption against license capacity. You can then [shape log data](/control/shaping/shape-logs/parse-logs) to apply finer-grained control. > [!NOTE] > > Prefer a guided lab? Take [Introduction to Consumption > Pricing](/academy/courses/introduction-to-consumption-pricing) to learn pricing, > partitions, budgets, and usage visibility, or take [Investigating Consumption > Increases](/academy/courses/investigating-consumption-increases) when credits climb > or budgets fire and you need to find scope and next steps. ## How to optimize telemetry data To manage your telemetry data consumption, complete the following steps: 1. [Create partitions](/control/consumption/partitions). 2. [Analyze consumption](/control/consumption/analyze). 3. [Create budgets](/control/consumption/budgeting). 4. [Monitor budgets](/control/consumption/budgeting#next-steps). 5. [Shape telemetry data](/control/shaping/shape-logs). > [!NOTE] > > To delete data from your Palo Alto Networks Cortex XCOR tenant, contact > [Cortex XCOR Support](/support). # Analyze consumption Source: https://docs-xcor.paloaltonetworks.com/control/consumption/analyze Analyze telemetry consumption across products, resources, and partitions to identify growth and unexpected spikes. After [creating partitions](/control/consumption/partitions), use the Consumption page to identify unexpected spikes, understand growth, and compare usage across partitions. The Consumption page displays consumption for the selected product, resource group, resource, and time range. For applicable global partition views, the page also displays contractual volume consumed and contract duration elapsed. The page includes budget thresholds and consumption statistics for child partitions. To compare telemetry rates with the system limits configured for your tenant, use the [Consumption System Limits dashboard](/observe/dashboards/managed-dashboards#consumption-system-limits). That dashboard is the source of truth for system limit thresholds, utilization, and data dropped by system limit enforcement. > [!NOTE] > > Prefer a guided lab? Take > [Investigating Consumption Increases](/academy/courses/investigating-consumption-increases) > to trace spikes across partitions and products and decide what to do next. ## Analyze with the Consumption page To analyze data consumption in the Consumption page, in the navigation menu, click ** Go to admin view** and then select **License > Consumption**. ### Select consumption data Use the page controls to define the consumption data to analyze: 1. Select a **Product**, **Resource Group**, and **Resource**. The available resource groups and resources depend on the selected product. 2. Review the unit selector, if present. Select **Credits** or **Native units** when both options are enabled. The page uses credits when the selection includes multiple resources. 3. Select the page time range. The available ranges include **This month** and **Previous month**. The page time range controls which data the page retrieves. The **Time window** menu in the Consumption chart controls how the retrieved data is aggregated. ### Review partition statistics The partition summary is named for the selected partition. For example, the global partition displays the Global Partition summary. The summary includes the following statistics: * Use **Consumed** to view the total data consumed and persisted during the selected time range. For the global partition, this statistic also displays the percentage of contractual volume when contract details apply to the selected range. * Use **Dropped by budgets** to view the total data dropped by budget enforcement during the selected time range. * If **Dropped by system limits** appears, use it to view the total data dropped by system limit enforcement during the selected time range. Click **View** to open the [Consumption System Limits dashboard](/observe/dashboards/managed-dashboards#consumption-system-limits) for the same time range. * Use **Change over time** to view the percentage change in consumption compared to the preceding period. The comparison period depends on the selected time range. For the global partition, review **Contract duration elapsed** when the selected time range falls within the contract period. Archived and unpartitioned partitions display corresponding badges. ### Analyze consumption trends In the Consumption chart, use the **Time window** menu to select how the chart aggregates consumption: * Use **Per second** to detect spikes. * Use **Daily**, **Weekly**, and **Monthly (Cumulative)** to identify gradual growth or sustained overconsumption. * Use **Rolling 30 minutes**, **Rolling 1 hour**, **Rolling 3 hours**, **Rolling 1 day**, or **Rolling 7 days** to identify recurring changes over rolling periods. Use the **Group by** menu to select how the chart divides the data: * **Consumed vs dropped** compares persisted volume with dropped volume. * **Consumed by partition** identifies which partitions account for the most consumption. * **Consumed by product** compares consumption across telemetry products. * **Consumed by resource** compares the resources within the selected product. * **Dropped by budget** or **Dropped by reason** compares dropped volume. If **Dropped by reason** appears, use it to separate budget drops from system limit drops. * **Dropped by partition** identifies which partitions account for dropped data. If the chart includes [budget thresholds](/control/consumption/budgeting#threshold-types), dashed lines indicate the threshold values. Use **Show thresholds** to show or hide these lines. When **Go to Explorer** appears for log data, click it to investigate the underlying data in [Logs Explorer](/investigate/querying/query-logs). ### Review budgets The Budgets table displays the thresholds that apply to the selected partition. Use the following columns to review each threshold: * **Product** and **Resource Group** identify the data that the threshold governs. * **Time window** identifies the period over which the threshold is evaluated. * **Action** identifies whether the threshold sends a warning alert, sends a critical alert, or drops data. When an action has an associated monitor, click the action to open that monitor. * **Threshold** displays the received volume as a percentage and value relative to the threshold. The received volume includes consumed and dropped data. * **View** selects the threshold's product and resource group, resets the resource to **All**, restores the threshold's original unit, and selects the matching chart time window. The Budgets table header reports the selected partition's budget status as Ok, Alerting, or Dropping. A partition without a budget displays no status badge, and the table displays `No budget`. The table can also display a system limit as Per second (max consumption rate). The Consumption System Limits dashboard remains the source of truth for system limit thresholds and enforcement. > [!NOTE] > > The budget for the `global` partition might exceed its threshold while budgets for > all child partitions remain within their thresholds. To make the global partition > budget reflect growth trends more accurately, set thresholds on budgets for > individual partitions. ### Compare child partitions The Child Partitions table compares the selected partition's immediate children. Search for a partition by name, or sort the table by the following columns: * **Order**: The order in which each child partition matches data. * **Partition**: The child partition name. Click a linked name to open that partition's Consumption page. Unpartitioned rows aren't linked. Archived and unpartitioned rows display corresponding badges. * **Consumed**: The partition's percentage of its parent's consumed volume and its absolute consumed value. * **Dropped**: The partition's percentage of its parent's dropped volume and its absolute dropped value. * **Change over time**: The percentage change in consumption compared to the preceding period. The column name reflects the comparison period. * **Current budget status**: The partition's current budget status. Partitions without a budget display **No budget**. Rows with an unavailable or unknown status display `--`. Use this table to investigate partitions with growing consumption or dropped data. ## Next steps Based on your findings, refine your [partitions](/control/consumption/partitions) with more specific dimensions. For example, add child partitions to control smaller subsets of data. After analyzing your consumption and refining partitions, create [budgets](/control/consumption/budgeting) to apply shaping policies that provide guardrails against usage overages and overspending. # Telemetry data budgets Source: https://docs-xcor.paloaltonetworks.com/control/consumption/budgeting Learn how to create and manage budgets and apply them to your data partitions. After [defining partitions](/control/consumption/partitions), [analyzing consumption](/control/consumption/analyze), and making any necessary adjustments, you can create *budgets*, which are shaping policies that you can attach to a partition. Budgets provide guardrails to combat runaway usage and overspending, while providing the flexibility to enforce accountability at the right level of ownership. Budgets include *thresholds* that define which actions to take when a threshold is exceeded. You can also set *priorities* to control the order in which an instant-rate threshold drops data that exceeds its configured rate, with lower priority values dropped last. For example, a priority of `10` is dropped first, and a priority of `1` is dropped last. Priorities are evaluated in match order, and the first priority to match is applied. All other priorities are ignored. Use the `default_priority` field to set the priority on requests that don't match any defined priorities. > [!NOTE] > > Prefer a guided lab? Take > [Applying Budgets to Partitions](/academy/courses/applying-budgets-to-partitions) > to configure multi-threshold budgets and read partition usage against those thresholds. ## Threshold types Budgets can include *thresholds*, which help manage both anomalous spikes in data and slow data growth over time, depending on the type. Use different threshold types depending on the use case. For each threshold, you can specify an action, such as sending an alert or dropping data. When you define an alert action on a threshold, such as sending a warning alert, Palo Alto Networks Cortex XCOR generates an associated monitor in the **Cortex XCOR Managed** [collection](/administer/collections). > [!NOTE] > > Although configuring thresholds is optional, Cortex XCOR strongly recommends setting > thresholds to protect budgets and avoid overspending. ### Anomalous spikes in real time To detect data spikes in real time and react accordingly, configure either an instant-rate threshold or a rolling threshold. These thresholds implement shorter time windows that are more responsive, but can result in more noise. Instant-rate thresholds limit the rate of incoming data in bytes per second, specified as fixed values. With an instant rate threshold, the configured action (such as sending an alert) triggers when consumption exceeds the configured rate threshold. For example, if a threshold is exceeded, Cortex XCOR can send an alert to notify the team who owns the budget for the offending partition. Alternatively, you can start dropping data when a threshold value is met so that the budget isn't exceeded, which would otherwise impact your persisted data limit. Instant-rate thresholds apply only to the `LOG_PERSISTED_BYTES` and `LOG_PROCESSED_BYTES` resource groups. Metric, trace, and credit-based resource groups don't support instant-rate thresholds. For those resource groups, use a rolling or fixed volume-based threshold instead. For alert actions on instant-rate thresholds, configure `instant_rate_sustain_secs` in the `alert_action_config` to control how long consumption must exceed the threshold before an alert triggers. The default is `0`, which triggers an alert immediately on any breach. Rolling thresholds help to detect and manage anomalous spikes in data over a short period, such as one to three hours. The available rolling threshold types are: * `ROLLING_30_MINUTE_VOLUME`: Rolling thirty-minute window. * `ROLLING_1_HOUR_VOLUME`: Rolling one-hour window. * `ROLLING_3_HOUR_VOLUME`: Rolling three-hour window. * `ROLLING_1_DAY_VOLUME`: Rolling one-day window. * `ROLLING_7_DAY_VOLUME`: Rolling seven-day window. ### Slow growth over time To help detect and manage gradual data growth over a longer period (which can be daily, weekly, or monthly), use fixed volume-based thresholds. These thresholds implement longer time windows that are less responsive, but are also less noisy than instant-rate or rolling thresholds. The available fixed volume threshold types are: * `DAILY_VOLUME`: Resets daily at `00:00:00` UTC. * `WEEKLY_VOLUME`: Resets weekly on Monday at `00:00:00` UTC. * `MONTHLY_VOLUME`: Resets on the first of each month at `00:00:00` UTC. Fixed volume-based thresholds set a limit over a fixed, non-overlapping period, such as one day. The configured action, such as dropping data, triggers when consumption over the specified time period exceeds the configured threshold. For example, dropping data on a daily basis if a budget for a service exceeds a fixed value threshold of a configured number of bytes. > [!NOTE] > > The `HOURLY_VOLUME` threshold type is deprecated, and the Cortex XCOR API rejects it > when you create or update a budget. To set an hourly window, use > `ROLLING_1_HOUR_VOLUME` instead. ### Drop data with thresholds When certain thresholds with a drop action are exceeded, Cortex XCOR drops data according to the length of the time window and the threshold type: * Instant-rate thresholds: Cortex XCOR accepts requests at a rate of up to the threshold value, and drops data when the rate is over the threshold in priority order. Data resumes when the incoming rate becomes less than the threshold. * Fixed volume-based thresholds: Cortex XCOR drops data until the end of the time window. For example, a daily volume-based threshold that's configured to drop data at 12:00 AM drops all matching requests until 11:59 PM. Priorities don't protect data after a fixed-volume threshold is exhausted. * Rolling thresholds: Cortex XCOR drops data until the data in the affected budget naturally ages out of the rolling window, and your tenant consumption is under the configured threshold. Avoid setting multiple volume-based thresholds with a drop action on the same budget. For example, setting a daily, weekly, and monthly volume-based threshold provides considerable overlap, and could result in unwanted noise, such as excessive alerts. > [!NOTE] > > The `DROP` action isn't supported for the trace resource groups > (`TRACE_PROCESSED_BYTES`, `TRACE_PERSISTED_BYTES`, and `TRACE_ALL`) or for the > cross-telemetry `ALL` resource group. For those resource groups, use an alert action > instead. See [Create budgets](#create-budgets) for an explanation of configuring > alert actions on budget thresholds. Each combination of resource group, action, and threshold type must be unique within a budget. For example, a budget can't contain two `DROP` thresholds that are both `INSTANT_RATE` for the `LOG_PERSISTED_BYTES` resource group. Two `DROP` and `INSTANT_RATE` thresholds are allowed when their resource groups differ. The `global` partition enforces the rate limits from your contract as system thresholds. You can't create a threshold on the `global` partition that duplicates a system-enforced combination of resource group, action, and threshold type. Set custom thresholds on child partitions instead. ## Budgeting order If you attach multiple budgets to every level of your partition hierarchy, a single request must pass through multiple thresholds before being accepted. Budgets are evaluated in order, from the most-specific partition that you created, to the least-specific partition (the global partition). If a budget drops a request, then data isn't counted in the received rates of any parent budgets. For example, consider the following partitions and budgets: * A partition for `global/team-a` has an `instant_rate` threshold of 2 MB per second. * A partition for `global/team-a/service-1` has an instant rate threshold of 1 MB per second. ```mermaid actions={false} theme={null} flowchart TD accTitle: Budget hierarchy accDescr: The global partition contains the team-a partition, which contains the service-1 partition. global --> team-a team-a --> service-1 ``` If the partition `global/team-a/service-1` receives a huge data spike of 1 GB per second, then 999 MB of that overage is dropped before it's counted against the budget for `global/team-a`. Therefore, the `global/team-a` partition receives only 1 MB per second, and won't be impacted by data drops. This budget hierarchy ensures that drop data from the `global/team-a/service-1` partition only, and not from `global/team-a`. The budget that's configured on the individual service ensures that the team budget isn't impacted. This behavior lets you penalize bad actors without impacting the upstream partitions. ## View budgets Select from one of the following methods to view budgets for partitions. > [tab] Web > > To view budgets for a partition: > > 1. In the navigation menu, click ** Go to admin view** > and then select > **License > Partitions and Budgets**. > 2. Select a partition from the side navigation or the **Child partitions** table. > 3. Click the **Budget** tab. > > The **Budget Thresholds** section displays configured thresholds, and the > **Log priorities** section displays the priority order for drop actions. > [tab] Chronoctl > > To use [Chronoctl](/tooling/chronoctl) to return all budgets, use the > `chronoctl consumption-budgets list` command: > > ```shell theme={null} > chronoctl consumption-budgets list > ``` > > To filter for a specific budget, use the `chronoctl consumption-budgets read` > command: > > ```shell /SLUG/ theme={null} > chronoctl consumption-budgets read SLUG > ``` > > Replace *`SLUG`* with the slug of the budget you want to display. > [tab] API > > To return a list of budgets with the Cortex XCOR API, use the > [`ListConsumptionBudgets`](/tooling/api-info/definition/operations/ListConsumptionBudgets) > endpoint. > > To return a single budget definition, use the > [`ReadConsumptionBudget`](/tooling/api-info/definition/operations/ReadConsumptionBudget) endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Create budgets When creating a budget, complete the following actions: * Required: Include the slug path of the partition that the budget applies to. * Optional: Specify an alert notification policy to use for routing alerts. * Optional (but highly suggested): Define thresholds and actions to take if a threshold is exceeded. * Optional: Apply priorities for each of the query conditions that match. Configure alert actions before enforcing drops. Alerts provide visibility without impacting persisted data. Cortex XCOR generates a monitor in the **Cortex XCOR Managed** collection for each resource group and threshold type combination that has an alert action. To configure a generated monitor, specify metadata in the `alert_action_config` section of the budget definition. For example, you can add `annotations` that include links to runbooks, and specify `labels` that can include metadata like `team` and `environment`. These labels can be used for routing notifications, such as to specific teams to notify when an alert triggers. For details, see the [Chronoctl documentation](/tooling/chronoctl) and [budget example](#chronoctl-budget-example), or the [Terraform provider documentation](/tooling/infrastructure/terraform) and [budget example](#terraform-budget-example). You can specify multiple alert actions for the same resource group and threshold type. For example, define a warning alert at one value, and then a critical alert at a higher value. Cortex XCOR combines those alert actions into one monitor. ### Prerequisites Before creating budgets, [define partitions](/control/consumption/partitions). Use the slug or ID of your partition to assign budgets. Because budgets use Cortex XCOR alerts to send notifications when thresholds are exceeded, you need to define [notification policies](/investigate/alerts/notifications/policies) to reference in your budgets. ### Create partition budgets Use one of the following methods to create budgets for partitions. > [tab] Web > > Define the budget in Cortex XCOR, and then > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply the > definition. > > 1. In the navigation menu, click ** Go to admin view** > and then select > **License > Partitions and Budgets**. > 2. Select the partition you want to add a budget to. > 3. Click the **Budget** tab. > 4. In the **Budget Thresholds** section, click **Add threshold**. > 5. For each threshold, select values for the **Product**, **Resource group**, > **Time window**, and **Action** fields, and then enter a threshold value. After > entering a threshold value, select a unit for the value. The available units depend > on the selected resource group and time window. > 6. Optional: In the **Log priorities** section, click **Add priority** to define > drop-order priorities. For each priority, enter a value in the **Priority** field > and a query in the **Filter** field. > 7. Optional: In the **Notification policy** section, select a notification policy > to route alerts raised by budget thresholds. > 8. To save the budget and apply changes to the configuration, click the > **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply > the definition. > [tab] Chronoctl > > To use [Chronoctl](/tooling/chronoctl) to create a budget, use the > `chronoctl consumption-budgets create` command: > > ```shell theme={null} > chronoctl consumption-budgets create > ``` > > 1. Run the following command to generate a sample budget configuration you can use as > a template: > > ```shell theme={null} > chronoctl consumption-budgets scaffold > ``` > > In the template, `kind: ConsumptionBudget` defines an individual budget. > > You can redirect the results (using the redirection operator `>`) to a file for > editing. > > 2. With a completed definition, submit it with: > > ```shell /FILE_NAME/ theme={null} > chronoctl consumption-budgets create -f FILE_NAME > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > > See the [Chronoctl example](#chronoctl-budget-example) for a completed budget > resource. > [tab] Terraform > > > [!NOTE] > > > > When you run `terraform plan` to generate an execution plan, Cortex XCOR automatically > > tests configurations that include notification policies by submitting them as dry runs. > > For details, see the > > [Terraform provider](/tooling/infrastructure/terraform#validate-plans-with-dry-runs) > > documentation. > > To create a budget with the > [Terraform provider](/tooling/infrastructure/terraform): > > 1. Create or edit a Terraform file and add the definition by using the > `chronosphere_consumption_budget` type. > 2. Enter a `consumption_config_id` for the budget. > 3. Include the `notification_policy_id` that references the ID of the > notification policy you want to use for routing alerts. > 4. Include the `partition_slug_path` that references the slug of the partition you > want to assign this budget to. > 5. Define a `threshold` condition to send alerts. > 6. Define a `threshold` condition to drop data. > 7. Run this command to apply the changes: > > ```shell theme={null} > terraform apply > ``` > > See the [Terraform budget example](#terraform-budget-example) for a completed > budget resource. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`CreateConsumptionBudget`](/tooling/api-info/definition/operations/CreateConsumptionBudget) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ### Next steps After creating budgets, use the Consumption page to monitor and [analyze consumption](/control/consumption/analyze) for the budget you added to your partition: * Review relative consumption trends: In the **Consumption** panel group, use the dropdown menus to view consumption trends across different time periods to understand what's driving data growth. * Detect budgets approaching thresholds: Use the **Budgets** panel group to compare data for the selected partition with its threshold. The global partition uses the maximum consumption rate set in your contract. Custom partitions use their configured thresholds. * Observe drops from rate-limiting thresholds per partition: In the **Group by** menu, select **Consumed vs dropped**. The chart groups the rate of data dropped by a threshold for the selected partition by priority, if configured. ### Chronoctl budget example The following Chronoctl example adds a budget for the Ordering Service, which is included in the [partition hierarchy](/control/consumption/partitions#partition-hierarchy) diagram. See the [Chronoctl example](/control/consumption/partitions#chronoctl-partition-example) that implements a partition for this service. This budget is scoped to the partition `global/ordering-team/ordering-service`, and defines the following thresholds: * An alert warning (`ALERT_WARN`) with a threshold of 4,500 bytes per second. * A critical warning (`ALERT_CRITICAL`) with a threshold of 5,000 bytes per second. * A drop action (`DROP`) with a threshold of 5,000 bytes per second. * A drop action (`DROP`) for daily volume, with a threshold of 909,997 bytes. Each `priority` controls which data the instant-rate `DROP` action discards first. Higher priority values are dropped first, and lower priority values are dropped last: * The query `"env = 'dev'"` has a priority of `10`, so it's dropped first. * The query `"env = 'staging'"` has a priority of `5`, so it's dropped next. * The query `"env = 'prod'"` has a priority of `1`, so it's dropped last. The daily volume `DROP` action drops all matching requests after its threshold is exhausted, regardless of these priorities. ```yaml expandable Chronoctl example icon="square-terminal" theme={null} api_version: v1/config kind: ConsumptionBudget spec: slug: "ordering-service-logs" name: "Ordering Service Logs" partition_slug_path: "global/ordering-team/ordering-service" alert_action_config: annotations: runbook: "https://wiki.example.com/runbooks/log-budget-alerts" team: "ordering-engineering" description: "Custom description for log budget alerts" labels: severity: "high" environment: "production" service: "ordering-service" instant_rate_sustain_secs: 60 priorities: - filters: - log_filter: query: "env = 'dev'" priority: 10 - filters: - log_filter: query: "env = 'staging'" priority: 5 - filters: - log_filter: query: "env = 'prod'" priority: 1 thresholds: - action: ALERT_WARN instant_rate: fixed_value_per_sec: 4500 type: INSTANT_RATE resource_group: LOG_PERSISTED_BYTES unit: NATIVE - action: ALERT_CRITICAL instant_rate: fixed_value_per_sec: 5000 type: INSTANT_RATE resource_group: LOG_PERSISTED_BYTES unit: NATIVE - action: DROP instant_rate: fixed_value_per_sec: 5000 type: INSTANT_RATE resource_group: LOG_PERSISTED_BYTES unit: NATIVE - action: DROP volume: fixed_value: 909997 type: DAILY_VOLUME resource_group: LOG_PERSISTED_BYTES unit: NATIVE notification_policy_slug: "budget-alerts-slack" ``` ### Terraform budget example The following Terraform provider example adds a budget for the Ordering Service, which is included in the [partition hierarchy](/control/consumption/partitions#partition-hierarchy) diagram. See the [Terraform provider example](/control/consumption/partitions#terraform-partition-example) that implements a partition for this service. This budget is scoped to the partition `global/ordering-team/ordering-service`, and defines the following thresholds: * An alert warning (`ALERT_WARN`) with a threshold of 4,500 bytes per second. * A critical warning (`ALERT_CRITICAL`) with a threshold of 5,000 bytes per second. * A drop action (`DROP`) with a threshold of 5,000 bytes per second. * A drop action (`DROP`) for daily volume, with a threshold of 909,997 bytes. Each `priority` controls which data the instant-rate `DROP` action discards first. Higher priority values are dropped first, and lower priority values are dropped last: * The query `"env = 'dev'"` has a priority of `10`, so it's dropped first. * The query `"env = 'staging'"` has a priority of `5`, so it's dropped next. * The query `"env = 'prod'"` has a priority of `1`, so it's dropped last. The daily volume `DROP` action drops all matching requests after its threshold is exhausted, regardless of these priorities. The `notification_policy_id` references a notification policy created with the Terraform provider. To reference a notification policy created in Cortex XCOR, enclose the value in double quotes. ```terraform expandable Terraform example icon="square-terminal" theme={null} resource "chronosphere_consumption_budget" "ordering_service_budget" { consumption_config_id = chronosphere_consumption_config.example.id name = "Ordering Service Logs" slug = "ordering-service-logs" notification_policy_id = chronosphere_notification_policy.budget_alerts_slack.id partition_slug_path = "global/ordering-team/ordering-service" # Alert action configuration alert_action_config { # Additional annotations to set on generated monitors # These override settings on default annotations if they match default keys annotations = { "runbook" = "https://wiki.example.com/runbooks/log-budget-alerts" "team" = "ordering-engineering" "description" = "Custom description for log budget alerts" } # Additional labels for notification routing labels = { "severity" = "high" "environment" = "production" "service" = "ordering-service" } # Determines how long instant rate consumption must sustain above the threshold # before triggering an alert # Default is 0 (any consumption over threshold triggers immediately) instant_rate_sustain_secs = 60 } # Threshold configurations threshold { action = "DROP" type = "INSTANT_RATE" resource_group = "LOG_PERSISTED_BYTES" unit = "NATIVE" instant_rate { fixed_value_per_sec = 5000 } } threshold { action = "ALERT_WARN" type = "INSTANT_RATE" resource_group = "LOG_PERSISTED_BYTES" unit = "NATIVE" instant_rate { fixed_value_per_sec = 4500 } } threshold { action = "ALERT_CRITICAL" type = "INSTANT_RATE" resource_group = "LOG_PERSISTED_BYTES" unit = "NATIVE" instant_rate { fixed_value_per_sec = 5000 } } threshold { action = "DROP" type = "DAILY_VOLUME" resource_group = "LOG_PERSISTED_BYTES" unit = "NATIVE" volume { fixed_value = 909997 } } # Priorities determine the instant-rate drop order # The default priority applies to requests that don't match any priority filter. # If unset, the priority defaults to 10 (dropped first). default_priority = 5 priority { priority = 1 filter { log_filter { query = "env = 'prod'" } } } priority { priority = 5 filter { log_filter { query = "env = 'staging'" } } } priority { priority = 10 filter { log_filter { query = "env = 'dev'" } } } } ``` ## Update budgets Select from one of the following methods to update budgets for available partitions. Any changes to the `notification_policy_slug` or `alert_action_config` are automatically updated in the monitor for the associated threshold. > [!WARNING] > > If you remove an alert threshold, Cortex XCOR deletes the generated > monitor only when no other alert uses the same resource group and threshold type. > [tab] Web > > To edit a budget in Cortex XCOR: > > 1. In the navigation menu, click ** Go to admin view** > and then select > **License > Partitions and Budgets**. > 2. Select the partition whose budget you want to update. > 3. Click the **Budget** tab. > 4. To edit a threshold, click the actions menu on the threshold row and select > **Edit**. Update the values inline. > 5. To reorder priorities, drag and drop priority rows to change their match order. > 6. To change the notification policy, select a different policy from the > **Notification policy** dropdown. > 7. To save changes to the configuration, click the **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply > the definition. > [tab] Chronoctl > > To update budgets with [Chronoctl](/tooling/chronoctl), use the > `consumption-budgets update` command: > > ```shell theme={null} > chronoctl consumption-budgets update > ``` > [tab] Terraform > > To edit a budget using the > [Terraform provider](/tooling/infrastructure/terraform): > > 1. Create or edit a Terraform file that updates the resource's existing properties. > 2. Run this command to apply the changes: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateConsumptionBudget`](/tooling/api-info/definition/operations/UpdateConsumptionBudget) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Delete budgets Select from one of the following methods to delete budgets for partitions. > [!NOTE] > > Users can modify Terraform-managed resources only by using Terraform. > [Learn more](/tooling/infrastructure/terraform#prevent-changes-to-managed-resources). > [tab] Web > > To delete individual thresholds or priorities from a budget: > > 1. In the navigation menu, click ** Go to admin view** > and then select > **License > Partitions and Budgets**. > 2. Select the partition whose budget items you want to remove. > 3. Click the **Budget** tab. > 4. To delete a threshold, click the actions menu on the threshold row and select > **Delete**. > 5. To delete a priority, click the actions menu on the priority row and select > **Delete**, and then confirm the deletion. > 6. To apply the deletion, click the **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply > the definition. > [tab] Chronoctl > > To delete budgets with [Chronoctl](/tooling/chronoctl), use the > `consumption-budgets delete` command: > > ```shell theme={null} > chronoctl consumption-budgets delete SLUG > ``` > > Replace *`SLUG`* with the slug of the budget you want to delete. > [tab] Terraform > > To delete a resource that's managed by [Terraform](/tooling/infrastructure/terraform): > > 1. Edit your Terraform configuration file to remove the pre-existing resource > definition. > 2. Run this command to remove the resource from Cortex XCOR: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`DeleteConsumptionBudget`](/tooling/api-info/definition/operations/DeleteConsumptionBudget) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. # Partitions Source: https://docs-xcor.paloaltonetworks.com/control/consumption/partitions Use partitions in Palo Alto Networks Cortex XCOR to create slices of your data with meaningful dimensions and distinct owners. *Partitions* separate telemetry data in Palo Alto Networks Cortex XCOR into meaningful slices that map to your business. Partitions provide a consistent structure for attributing usage and costs to the appropriate owners in your organization so they can isolate and independently control their parts of the business. > [!NOTE] > > Prefer a guided lab? Take [Designing Partitions](/academy/courses/designing-partitions) to > design partition hierarchy and generate consumption configuration, or take [Applying Budgets > to Partitions](/academy/courses/applying-budgets-to-partitions) to attach budgets > and interpret usage against thresholds. ## Partition hierarchy Partitions are hierarchical, which lets you model the ownership structure of your organization. A global partition is created by default, and captures all consumption. Individual teams can create distinct partitions, with child partitions for individual services and environments. All created partitions are children of the global partition, and each created partition has a default partition to collect any traffic not explicitly captured by other partitions. Default partitions are created automatically, and ensure that all consumption is accounted for at every level and sums correctly into parent partitions. The following diagram depicts the hierarchy of partitions stemming from the `global` partition. Two created partitions are children of the `global` partition: one for the `ordering_team` and another for the `auth-team`. Each of those partitions have child partitions for each team's individual service, with additional child partitions for `prod`, `staging`, and `dev` environments. ```mermaid actions={false} theme={null} --- title: Partition tree --- flowchart TD accTitle: Partitions stemming from the global partition accDescr: The diagram shows a global partition, with three child partitions. One each for the ordering team, auth team, and a default partition. The ordering team and auth team partitions have child partitions for their individual services, which have their own partitions for different environments. global[global] global --> ordering_team[ordering-team] ordering_team --> ordering_service[ordering-service] ordering_service --> ordering_prod[prod] ordering_service --> ordering_staging[staging] ordering_service --> ordering_dev[dev] ordering_service --> ordering_default[default] ordering_team --> ordering_team_default[default] global --> auth_team[auth-team] auth_team --> auth_service[auth-service] auth_service --> auth_prod[prod] auth_service --> auth_staging[staging] auth_service --> auth_dev[dev] auth_service --> auth_default[default] auth_team --> auth_team_default[default] global --> global_default[default] classDef green fill:#007A3D,stroke:#000,stroke-width:2px,color:#FFFFFF,font-weight:bold,underline; classDef coral fill:#FA582D,stroke-width:2px,stroke:#FA582D,color:#000000,font-weight:bold,underline; classDef orange fill:#ff9d1c,stroke-width:2px,stroke:#ff9d1c,color:#FFFFFF,font-weight:bold,underline; class ordering_team,ordering_service,ordering_dev,ordering_staging,ordering_prod green class auth_team,auth_service,auth_prod,auth_staging,auth_dev coral class global_default,ordering_team_default,ordering_default,auth_team_default,auth_default orange ``` ## Filters Each partition uses one or more filters to determine which telemetry data the partition captures. A request must match every filter to be assigned to the partition. Each filter uses one of the following operators: * `IN`: the request must match at least one of the filter's conditions. * `NOT_IN`: the request must not match any of the filter's conditions. A partition with multiple `IN` or `NOT_IN` filters save each condition into a single `IN` and `NOT_IN` operator collection. Each condition matches exactly one telemetry type through one of the following fields: * `log_filter`: matches log data with a log query. * `metric_filters`: matches metric data by label. A metric must match every label filter in the condition. Label values support glob patterns, such as `service:{svc1,svc2}` to match alternatives. * `trace_span_filters`: matches trace data at the span level. A span must satisfy every span filter in the condition. ### Trace span filters A trace span filter matches spans on one or more of the following fields. To match alternatives, use an `IN` string filter or separate conditions. * `service`: the service of the span. * `operation`: the operation of the span. * `parent_service`: the service of the span's parent span. Root spans don't match. * `parent_operation`: the operation of the span's parent span. Root spans don't match. * `duration`: the duration of the span. An omitted or zero bound is unbounded on that side. * `error`: the error status of the span. * `tags`: the tags of the span. A numeric matcher also compares numeric-looking string tag values. * `is_root_span`: whether the span is the root span of its trace. ## View partitions Select from the following methods to view and filter available partitions. > [tab] Web > > To view partitions: > > 1. In the navigation menu, click ** Go to admin view** > and then select > **License > Partitions and Budgets**. > > The global partition and any defined child partitions display. > > 2. To view the definition for a specific partition, select it from the > **Child partitions** table, or from the side navigation. > > The child partition's definition displays in the **Details** tab. > > 3. With a child partition selected, click the **Budget** tab to view the defined > [budget thresholds](/control/consumption/budgeting) attached to that partition. > [tab] Chronoctl > > To use [Chronoctl](/tooling/chronoctl) to return all partitions, use the > `chronoctl consumption-config read` command: > > ```shell theme={null} > chronoctl consumption-config read > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`ReadConsumptionConfig`](/tooling/api-info/definition/operations/ReadConsumptionConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Create partitions Select from the following methods to create partitions. Each partition can have up to five levels of nesting. Partitions are applied in match order as listed in your configuration file. If data matches multiple partitions, Palo Alto Networks Cortex XCOR applies the first partition that the data matches in the configuration file. > [!NOTE] > > A consumption configuration supports a maximum of 100 total partitions, including > the default partition that Cortex XCOR generates automatically for each > non-empty partition list. For example, a flat configuration supports up to 99 > configured partitions because its default partition brings the total to 100. > Nested configurations can support fewer configured partitions because each non-empty > child partition list generates another default partition. If you reach the limit, > consolidate partitions or contact [Cortex XCOR Support](/support). > [tab] Web > > Define the partition definition in Cortex XCOR, and then > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply the > definition. > > 1. In the navigation menu, click ** Go to admin view** > and then select > **License > Partitions and Budgets**. > > 2. Click **New partition**, and then enter a name for your partition. > > 3. In the side navigation, select your new partition to configure it. > > 4. If you want to use a different display name or slug for the new partition, enter > new values. > > > [!WARNING] > > > > After applying the partition configuration, the slug value can't be changed. > > 5. Select the parent partition for the new partition to belong to. > > 6. Define filters, which determine the data that belongs to this partition. For each > filter, select **In** or **Not in** from the **Operator** menu to include or > exclude matching data, and then enter the **Conditions**. The condition format > depends on the telemetry type: > > * Logs: a log query. > * Metrics: label-value pairs. > * Traces: span fields, such as service or operation. > > For how the **In** and **Not in** operators combine, see [Filters](#filters). For > examples of filters, see the [Chronoctl example](#chronoctl-partition-example) and > the [Terraform example](#terraform-partition-example). > > 7. To create child partitions in the new partition, in the **Child partitions** > section, click **New partition**. > > > [!NOTE] > > > > Partitions support a maximum nesting depth of five levels from the global > > partition. > > 8. To save the new partition and apply changes to the configuration, click the > **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply > the definition. > > After applying the changes with the Code config tool, the new partitions displays in > the list of available partitions. > [tab] Chronoctl > > To use [Chronoctl](/tooling/chronoctl) to create partitions, use the > `chronoctl consumption-config create` command: > > ```shell theme={null} > chronoctl consumption-config create > ``` > > 1. Run the following command to generate a sample partition configuration you can use > as a template: > > ```shell theme={null} > chronoctl consumption-config scaffold > ``` > > In the template, `kind: ConsumptionConfig` defines an individual partition. > > 2. With a completed definition, submit it with: > > ```shell /FILE_NAME/ theme={null} > chronoctl consumption-config create -f FILE_NAME > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > > See the [Chronoctl partition example](#chronoctl-partition-example) for a completed > partition definition. > [tab] Terraform > > > [!NOTE] > > > > When you run `terraform plan` to generate an execution plan, Cortex XCOR automatically > > tests configurations that include notification policies by submitting them as dry runs. > > For details, see the > > [Terraform provider](/tooling/infrastructure/terraform#validate-plans-with-dry-runs) > > documentation. > > To create a partition with the > [Terraform provider](/tooling/infrastructure/terraform): > > 1. Create or edit a Terraform file and add the definition by using the > `chronosphere_consumption_config` type, followed by a name in a resource > declaration. > > 2. Run this command to apply the changes: > > ```shell theme={null} > terraform apply > ``` > > See the [Terraform partition example](#terraform-partition-example) for a completed > partition resource. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`CreateConsumptionConfig`](/tooling/api-info/definition/operations/CreateConsumptionConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ### Next steps After creating a partition, use the [Consumption](/control/consumption/analyze) page to view usage across partitions to understand what's driving growth and detect unwanted spikes. From the **Partitions and Budgets** page in Cortex XCOR, click **View in Consumption** to open the **Consumption** page. After analyzing consumption, create [budgets](/control/consumption/budgeting) and assign them to each of your partitions. ### Chronoctl partition example The following [Chronoctl](/tooling/chronoctl) example defines two partitions at the team level, each with a child service partition and environment sub-partitions for production, staging, and development environments. Each partition uses conditions for logs, metrics, and traces so that data from all three telemetry types is attributed to the correct owner. The `Ordering Team` partition matches services with a regular expression log query, a glob-based metric filter, and an `IN` trace span filter. The `Auth Team` partition adds a `NOT_IN` filter to exclude load-test traffic from its consumption totals. ```yaml expandable Chronoctl example icon="square-terminal" theme={null} api_version: v1/config kind: ConsumptionConfig spec: partitions: - name: "Ordering Team" slug: "ordering-team" filters: - operator: "IN" conditions: - log_filter: query: "service =~ 'ordering|order-processor'" - metric_filters: - name: "service" value_glob: "ordering*" - trace_span_filters: - service: match: "IN" in_values: - "ordering" - "order-processor" partitions: - name: "Ordering Service" slug: "ordering-service" filters: - operator: "IN" conditions: - log_filter: query: "service = 'ordering'" - metric_filters: - name: "service" value_glob: "ordering" - trace_span_filters: - service: match: "EXACT" value: "ordering" partitions: - name: "Prod" slug: "prod" filters: - operator: "IN" conditions: - log_filter: query: "env = 'prod'" - metric_filters: - name: "env" value_glob: "prod" - name: "Staging" slug: "staging" filters: - operator: "IN" conditions: - log_filter: query: "env = 'staging'" - metric_filters: - name: "env" value_glob: "staging" - name: "Dev" slug: "dev" filters: - operator: "IN" conditions: - log_filter: query: "env = 'dev'" - metric_filters: - name: "env" value_glob: "dev" - name: "Auth Team" slug: "auth-team" filters: - operator: "IN" conditions: - log_filter: query: "service =~ 'auth|auth-proxy'" - metric_filters: - name: "service" value_glob: "auth*" - trace_span_filters: - service: match: "IN" in_values: - "auth" - "auth-proxy" - operator: "NOT_IN" conditions: - log_filter: query: "env = 'load-test'" - metric_filters: - name: "env" value_glob: "load-test" partitions: - name: "Auth Service" slug: "auth-service" filters: - operator: "IN" conditions: - log_filter: query: "service = 'auth'" - metric_filters: - name: "service" value_glob: "auth" - trace_span_filters: - service: match: "EXACT" value: "auth" partitions: - name: "Prod" slug: "prod" filters: - operator: "IN" conditions: - log_filter: query: "env = 'prod'" - metric_filters: - name: "env" value_glob: "prod" - name: "Staging" slug: "staging" filters: - operator: "IN" conditions: - log_filter: query: "env = 'staging'" - metric_filters: - name: "env" value_glob: "staging" - name: "Dev" slug: "dev" filters: - operator: "IN" conditions: - log_filter: query: "env = 'dev'" - metric_filters: - name: "env" value_glob: "dev" ``` ### Terraform partition example The following [Terraform provider](/tooling/infrastructure/terraform) example defines the same structure as the [Chronoctl example](#chronoctl-partition-example), which includes two team partitions with nested service and environment partitions. Each filter block includes separate conditions for `log_filter`, `metric_filter`, and `trace_span_filters` so that logs, metrics, and traces are all routed to the matching partition. The `Auth Team` partition demonstrates combining an `IN` filter with a `NOT_IN` filter to include `auth` services while excluding `load-test` environment data. ```terraform expandable Terraform example icon="square-terminal" theme={null} resource "chronosphere_consumption_config" "example" { partition { name = "Ordering Team" slug = "ordering-team" filter { operator = "IN" condition { log_filter { query = "service =~ 'ordering|order-processor'" } } condition { metric_filter { name = "service" value_glob = "ordering*" } } condition { trace_span_filters { service { match = "IN" in_values = ["ordering", "order-processor"] } } } } partition { name = "Ordering Service" slug = "ordering-service" filter { operator = "IN" condition { log_filter { query = "service = 'ordering'" } } condition { metric_filter { name = "service" value_glob = "ordering" } } condition { trace_span_filters { service { match = "EXACT" value = "ordering" } } } } partition { name = "Prod" slug = "prod" filter { operator = "IN" condition { log_filter { query = "env = 'prod'" } } condition { metric_filter { name = "env" value_glob = "prod" } } } } partition { name = "Staging" slug = "staging" filter { operator = "IN" condition { log_filter { query = "env = 'staging'" } } condition { metric_filter { name = "env" value_glob = "staging" } } } } partition { name = "Dev" slug = "dev" filter { operator = "IN" condition { log_filter { query = "env = 'dev'" } } condition { metric_filter { name = "env" value_glob = "dev" } } } } } } partition { name = "Auth Team" slug = "auth-team" filter { operator = "IN" condition { log_filter { query = "service =~ 'auth|auth-proxy'" } } condition { metric_filter { name = "service" value_glob = "auth*" } } condition { trace_span_filters { service { match = "IN" in_values = ["auth", "auth-proxy"] } } } } filter { operator = "NOT_IN" condition { log_filter { query = "env = 'load-test'" } } condition { metric_filter { name = "env" value_glob = "load-test" } } } partition { name = "Auth Service" slug = "auth-service" filter { operator = "IN" condition { log_filter { query = "service = 'auth'" } } condition { metric_filter { name = "service" value_glob = "auth" } } condition { trace_span_filters { service { match = "EXACT" value = "auth" } } } } partition { name = "Prod" slug = "prod" filter { operator = "IN" condition { log_filter { query = "env = 'prod'" } } condition { metric_filter { name = "env" value_glob = "prod" } } } } partition { name = "Staging" slug = "staging" filter { operator = "IN" condition { log_filter { query = "env = 'staging'" } } condition { metric_filter { name = "env" value_glob = "staging" } } } } partition { name = "Dev" slug = "dev" filter { operator = "IN" condition { log_filter { query = "env = 'dev'" } } condition { metric_filter { name = "env" value_glob = "dev" } } } } } } } ``` ## Update partitions Select from the following methods to update partitions. > [tab] Web > > To update partitions: > > 1. In the navigation menu, click ** Go to admin view** > and then select > **License > Partitions and Budgets**. > > 2. In the sidebar navigation, select the partition you want to update. Alternatively, > in the **Child partitions** table, click the name of the partition, or click the > three vertical dots icon in the row of the > partition you want to update and then click **Edit**. > > 3. Make changes to the partition in the definition pane. > > 4. Click the **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply your > changes. > [tab] Chronoctl > > To update partitions with [Chronoctl](/tooling/chronoctl), use the > `consumption-config update` command: > > ```shell theme={null} > chronoctl consumption-config update > ``` > > 1. Update the partition definition file. > 2. Run the following command to submit the changes: > > ```shell /FILE_NAME/ theme={null} > chronoctl consumption-config update -f FILE_NAME.yaml > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > [tab] Terraform > > To edit partitions using the > [Terraform provider](/tooling/infrastructure/terraform): > > 1. Create or edit a Terraform file that updates the resource's existing properties. > 2. Run this command to apply the changes: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateConsumptionConfig`](/tooling/api-info/definition/operations/UpdateConsumptionConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Delete partitions Select from the following methods to delete partitions. To delete partitions with attached budgets, you must first [delete attached budgets](/control/consumption/budgeting#delete-budgets), and then delete the partition. > [!NOTE] > > Users can modify Terraform-managed resources only by using Terraform. > [Learn more](/tooling/infrastructure/terraform#prevent-changes-to-managed-resources). > [tab] Web > > To delete partitions: > > 1. In the navigation menu, click ** Go to admin view** > and then select > **License > Partitions and Budgets**. > > 2. In the sidebar navigation, select the partition you want to delete. Alternatively, > in the **Child partitions** table, click the > three vertical dots icon in the row of the partition you want to delete and then > click **Delete**. > > 3. Click the **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply your > changes. > [tab] Chronoctl > > To delete a partition with [Chronoctl](/tooling/chronoctl), use the > `chronoctl consumption-config delete` command: > > ```shell theme={null} > chronoctl consumption-config delete > ``` > [tab] Terraform > > To delete a resource that's managed by [Terraform](/tooling/infrastructure/terraform): > > 1. Edit your Terraform configuration file to remove the pre-existing resource > definition. > 2. Run this command to remove the resource from Cortex XCOR: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`DeleteConsumptionConfig`](/tooling/api-info/definition/operations/DeleteConsumptionConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. # Shape and sample your data Source: https://docs-xcor.paloaltonetworks.com/control/shaping Learn how to use shaping rules to take control of your telemetry data. To take control of your telemetry data, Palo Alto Networks Cortex XCOR provides multiple tools you can use to identify and eliminate data that isn't used and doesn't deliver value to your business. Use the Cortex XCOR Control Plane to reduce the amount of data retained in your system over time. Create *shaping rules* to drop data before it reaches Cortex XCOR, aggregate and rewrite data into more manageable and usable statistics, and alias expressions to improve data queries and references. ## Shape metric data Use the Cortex XCOR Control Plane to [shape your metric data](/control/shaping/shape-metrics) and reduce the amount of data you persist. Manage your telemetry data with tools that help you shape that traffic, such as creating drop rules, quotas, and aggregation rules. ## Sample trace data Create [trace datasets](/control/shaping/sample-traces/datasets) that map tracing license consumption to relevant business units in your organization. Datasets let you track and measure trace data usage over time before you implement proactive sampling strategies, whereas head and tail sampling alone require you to measure and implement together. You can then apply [behaviors](/control/shaping/sample-traces/behaviors) to set sampling rules for your datasets without having to write, coordinate, and manage head and tail sampling rules individually. ## Control log data Understanding your license consumption helps identify where you're spending the most money on your log data, and which services or operations are consuming the most of your license capacity. [Control log data](/control/shaping/shape-logs) to determine what portion of your license is allocated to the most important data. ## Review impact After creating rules that shape and sample your data, use the tools that Cortex XCOR provides to [review rule impact](/control/shaping/review-impact) and ensure the rules you created have the intended outcome. # Review shaping rules impact Source: https://docs-xcor.paloaltonetworks.com/control/shaping/review-impact Learn how to review the impact of your shaping rules to better apply controls to your telemetry data. After [creating shaping rules](/control/shaping), you want to understand their impact to ensure they have the intended outcome. Palo Alto Networks Cortex XCOR provides several tools to understand the impact of the shaping rules you create. ## Review metric shaping rules Use the [Aggregation Rules UI](/control/shaping/shape-metrics/reduce-cardinality/aggregation-rules) to understand your existing metric shaping rules and how they affect your environment. Use the [shaping impact preview](/control/shaping/shape-metrics/reduce-cardinality/shaping-impact) to preview the impact of a rule on your overall system, which helps prevent breaking changes and ensure the rules you create operate as expected. You can then use the [Live Telemetry Analyzer](/investigate/analyze/telemetry-analyzer) to review metrics with a **Data phase** filter that shows what data was dropped, matched, or rejected by specific rule types. Periodically review the [Recommendations](/control/shaping/shape-metrics/reduce-cardinality/recommendations) page to help identify metrics and labels with no usage or utility over the past 30 days. You can then create drop rules and rollup rules based on the recommendations. > [!NOTE] > > If your organization uses capacity pricing, you can define metrics > [quotas and pools](/control/shaping/shape-metrics/quotas/manage-pools) to assign specific > percentages of your total persisted writes limit to pools of metrics. If you identify data with no business value, apply [relabel rules](/investigate/querying/metrics/derived-telemetry#differences-between-relabeling-and-deriving) in your Chronosphere Collector to adjust which metrics you send from the client side to Cortex XCOR. ## Review log optimization rules When [creating a log shaping rule](/control/shaping/shape-logs), enter a filter to display a preview of the log data that the filter matches. This preview lets you confirm that the optimization rule targets the intended logs before applying the optimization rule. After creating log shaping rules, use the [Logs Usage](/investigate/analyze/logs-usage) page to review and understand frequent patterns in your log data. Use this information to identify high-volume, low-utility patterns, and confirm that a pattern's volume has changed after applying an optimization rule. You can then create an optimization rule for a pattern from the **Logs Usage** page with a defined filter, which ensures you're matching the correct pattern. ## Review trace optimization rules Use [Trace Optimization](/control/shaping/sample-traces) to both create and review the control mechanisms for trace data. After creating datasets, you can view the total processed and persisted bytes for a selected period to understand the data consumption. Before assigning behaviors, [run a preview](/control/shaping/sample-traces/behaviors#preview-behaviors) against a specific dataset to understand how it impacts data volume before shaping the data. Select a behavior to view head and tail sampling statistics so you can understand how the behavior affects traces that impact multiple datasets. After creating a [trace metric](/control/shaping/sample-traces/trace-metrics), you can pivot to view similar traces or view similar logs to cross-reference what data the metric is capturing. # Sample your traces Source: https://docs-xcor.paloaltonetworks.com/control/shaping/sample-traces Use sampling in Palo Alto Networks Cortex XCOR to help control costs and maximize the usefulness of your tracing data. Distributed traces provide an additional layer of context for solving problems across complex systems that include hundreds or thousands of microservices. However, you want to ensure you're only ingesting tracing data that's relevant and valuable. To help control costs and maximize the usefulness of your tracing data, use Trace Optimization to narrow your focus to only a representative sample of your data and drop everything else. To access Trace Optimization, in the navigation menu click ** Go to admin view**, and then select ** Optimization > Trace Optimization**. > [!NOTE] > > Prefer a guided lab? Take [Controlling Traces](/academy/courses/controlling-traces) to trace datasets, behaviors, and > sampling. ## Head and tail sampling *Head sampling* and *tail sampling* are the best-known strategies for sampling trace data * [Head sampling](/control/shaping/sample-traces/head-sampling) is a more blunt strategy that seeks to make a sampling decision as early as possible. Head sampling evaluates only a defined percentage of traces to take a representative sample of whole traces. * [Tail sampling](/control/shaping/sample-traces/tail-sampling) is more fine-grained, and evaluates every trace after assembling all spans. Tail sampling rules can consider request outcomes, such as whether a request succeeded or how long it took to complete, which isn't possible with head sampling. Creating and managing head and tail sampling rules can be challenging to ensure you're discarding and keeping the most impactful data. To simplify this process and decrease the learning curve of sampling, Palo Alto Networks Cortex XCOR developed two concepts to group, track, and apply sampling rules: [datasets](#datasets) and [behaviors](#behaviors). ## Datasets Create [*datasets*](/control/shaping/sample-traces/datasets) to map sets of traces to named groups relevant to your organization so you can track processed and persisted bytes for those groups over time. Datasets don't impact your license consumption, so you can experiment with creating datasets to understand your license usage and make changes as needed without consuming a portion of your license. With datasets in place, you can then apply behaviors to your datasets. ## Behaviors After creating datasets for individual business units, you can apply [*behaviors*](/control/shaping/sample-traces/behaviors) to your datasets to set sampling rates without needing to write and manage large sets of fine-grained sampling rules. You set a baseline behavior that implements data-driven best practices with default parameters. You can modify those parameters based on the needs of your organization. For example, modify the defined criteria to drop low-value traces as quickly as possible and keep high-value traces at a specified rate for one or more datasets from a single behavior. You can also set a behavior to allow (sample at 100%) or deny (sample at 0%) all traces for a specific period. For example, set an allow behavior when you need to increase the amount of high-fidelity data during a deploy, or when debugging issues. Alternatively, set a deny behavior when you want to decrease the amount of noisy or spam traces to keep your budget spend within limits. ## Get started with sampling Complete the following steps to get started with trace sampling in Cortex XCOR. 1. [Instrument head sampling](/control/shaping/sample-traces/head-sampling#configure-head-sampling), which is a prerequisite for using behaviors. Head sampling drives total trace volume for each root service and operation. Use Trace Optimization to manage head sampling as part of behaviors. 2. Optional: Create head and tail sampling rules: * [Create head sampling rules](/control/shaping/sample-traces/head-sampling#create-head-sampling-rules) * [Create tail sampling rules](/control/shaping/sample-traces/tail-sampling#create-tail-sampling-rules) > [!NOTE] > > Create these rules if you don't want to use behaviors for sampling management, > or if you already have head and tail sampling rules you want to migrate to and > manage within Cortex XCOR. 3. [Use the incomplete traces dataset](/control/shaping/sample-traces/datasets#identify-incomplete-traces) to identify incomplete traces. Incomplete traces are those where one or more spans lacks a parent span, like from a lack of instrumentation. 4. Recommended: Improve local instrumentation to ensure a higher volume of complete traces before creating independent datasets. 5. [Create a dataset](/control/shaping/sample-traces/datasets#create-datasets) per team or per environment to track the exact volume of trace data for that team or environment over time. 6. [Assign a baseline behavior](/control/shaping/sample-traces/behaviors#get-started-with-behaviors) to your datasets to ensure that you capture all of your most meaningful traces (such as slow traces and error traces) for incident response purposes. Use the baseline behavior to optionally capture fewer of your lower-priority traces (such as fast traces and successful traces) to obtain a system baseline. As you learn more about your trace data, you can [edit facets of the baseline behavior](/control/shaping/sample-traces/behaviors#customize-your-sampling-strategy) to modify your sampling strategy and more clearly define which traces to drop and which to keep. In most cases, you want to assertively drop less interesting, lower-value traces and keep more interesting, higher-value traces. In the Cortex XCOR app, you can modify the baseline sampling strategy and apply it across one or more datasets. # Use trace behaviors with datasets Source: https://docs-xcor.paloaltonetworks.com/control/shaping/sample-traces/behaviors Use behaviors in Palo Alto Networks Cortex XCOR to set sampling rules for your trace datasets without writing fine-grained sampling rules. Controlling the tracing data you process and persist is necessary to manage your license consumption. After creating [datasets](/control/shaping/sample-traces/datasets), you can apply trace *behaviors* to set sampling rates for your datasets without needing to write fine-grained sampling rules. Although datasets are the underpinning of behaviors, the behaviors themselves let you change the sampling rates of one or more datasets from either the Palo Alto Networks Cortex XCOR app or by using Chronoctl. ## Get started with behaviors Create the right datasets for your organization and then use behaviors to manage the data that those datasets generate. Use the built-in [behavior types](#trace-behavior-types) to control sampling rates and apply them across datasets. Cortex XCOR includes an unassigned dataset you can use for experimentation. The baseline behavior is mapped to the unassigned dataset by default, which lets you start sending traces to Cortex XCOR with pre-configured sampling rules based on best practices. As you learn about how the unassigned dataset generates data, create additional datasets for each of your individual services. As you learn more about your trace data, you can [edit facets of the baseline behavior](#customize-your-sampling-strategy) to modify your sampling strategy and define which traces to drop and which to keep. In most cases, you want to assertively drop less interesting, lower-value traces and keep more interesting, higher-value traces. In the Cortex XCOR app, you can quickly modify the baseline sampling strategy and apply it across one or more datasets. Trace behaviors implement head sampling rules by default, which means you need only set the percentage at which you want to keep processed data. For example, if you set the head sampling rate to 100%, you're keeping 100% of traces. If you don't set a behavior for a dataset, Cortex XCOR uses defined [tail sampling](/control/shaping/sample-traces/tail-sampling) rules. However, you can use trace datasets and behaviors without needing to write tail sampling rules. > [!NOTE] > > To specify a sample rate for head sampling in the baseline behavior, you must > instrument [head sampling](/control/shaping/sample-traces/head-sampling) first. Cortex XCOR > supports the OpenTelemetry JaegerRemoteSampler head sampling standard. > > Explicitly-defined [head sampling rules](/control/shaping/sample-traces/head-sampling#create-head-sampling-rules) > take precedence over head sampling rules defined by a behavior. To use behavioral > head sampling, [edit the baseline behavior](#edit-the-baseline-behavior) to define a > head sampling strategy, and then remove your existing head sampling rules. Behaviors are part of Trace Optimization, which also includes datasets and head and tail sampling rules. You need administrative access to use Trace Optimization. ## Trace behavior types Trace behaviors can be one of the following types: * **Baseline behavior**: Sample data in your datasets using data-driven best practices. Select which facets to apply to your low-value and high-value trace data, and modify the criteria as you learn more about the characteristics of your trace data. The baseline behavior is mostly proactive, and helps to identify what trace data to bring into Cortex XCOR and what data to drop. * **Allow behavior**: Sample your data at 100% to allow all traces. The allow behavior can be both proactive and reactive. For example, you might want more high-fidelity data during a deploy to catch any issues (proactive), or allow all traces from a specific service or operation when debugging issues (reactive). * **Deny behavior**: Sample your data at 0% to block all traces. The deny behavior can be both proactive and reactive. For example: * Proactive: drop all traces from a service because the data isn't needed. * Reactive: stop traces from a dataset that's currently generating too much data so you don't exceed your license limit. ## View behaviors You can view and filter available trace behaviors using Cortex XCOR, and return the trace behavior definition using Chronoctl. > [tab] Web > > To view trace behaviors: > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Trace Optimization**. > 2. Select the **Behaviors** tab to view the baseline, allow, and deny behaviors, > including which datasets each behavior type currently applies to. The dataset > match criteria displays the dataset definition the behavior operates on. > 3. Select the individual behavior you want to view details for: > > * **Allow**: Displays the assignment history for the datasets where the allow > behavior is currently active, and the datasets where this behavior ended. > * **Deny**: Displays the assignment history for the datasets where the deny > behavior is currently active, and the datasets where this behavior ended. > * **Baseline**: Displays head and tail sampling statistics for the baseline > behavior when it was active for any datasets. The assignment history displays > the datasets where the baseline behavior is currently active, and the > datasets where this behavior ended. > > You can [edit the baseline behavior](#customize-your-sampling-strategy) to > change the tail sampling methodology and modify the facets that define which > traces to drop and keep. > [tab] Chronoctl > > To use [Chronoctl](/tooling/chronoctl) to return the trace behavior definition, use the > `chronoctl trace-behavior-config read` command: > > ```shell theme={null} > chronoctl trace-behavior-config read > ``` > > The definition includes the main behavior and override behavior assignments for each > of your datasets, and also displays the dataset shaping order. See the > [Manage assigned behaviors](#manage-assigned-behaviors) section of this page for more > information about assigning behaviors to datasets. > > See the [Chronoctl behavior example](/control/shaping/sample-traces/datasets#chronoctl-behavior-example) > for a completed behavior definition. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`ReadTraceBehaviorConfig`](/tooling/api-info/definition/operations/ReadTraceBehaviorConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Manage assigned behaviors You can manage the assigned behaviors for a dataset on two levels: * Assign a *main behavior* to define the primary behavior for a dataset. * Assign an *override behavior* to temporarily override the main behavior. > [!NOTE] > > You can assign only one main behavior and one override behavior to a dataset. Both the main and override layers can use any of the [trace behavior types](/control/shaping/sample-traces/behaviors#trace-behavior-types), which are baseline, allow, and deny. You can also [create custom behaviors](/control/shaping/sample-traces/behaviors#create-custom-behaviors) and assign them to the main or override layers on datasets. When assigning a behavior to the override layer, you can set the behavior to start immediately, or schedule it to start at a future time. When managing assigned behaviors, you can set the shaping order for overlapping trace datasets. The shaping order determines the priority order to apply behaviors when traces in one dataset overlap with traces in another dataset. For example, if a trace belongs to more than one dataset with an assigned behavior, Cortex XCOR uses the behavior assigned to the dataset that's first in the shaping order. The shaping order applies only when the selected behavior is active. Select from the following methods to assign behaviors to a dataset. > [tab] Web > > > [!NOTE] > > > > If a behavior isn't currently assigned to a dataset, you must > > [assign behaviors](/control/shaping/sample-traces/datasets#assign-behaviors) to the dataset by > > selecting a dataset from the **Overview** tab of Trace Optimization. > > To assign behaviors to a dataset: > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Trace Optimization**. > > 2. Click the **Behaviors** tab, and then click the name of the behavior you want to > manage. > > 3. On the **Behavior Details** page, locate the dataset you want to manage behaviors > for, click the three vertical dots icon, and select > **Manage behaviors**. > > > [!NOTE] > > > > The selected behavior must be assigned to a dataset to manage it from the > > **Behaviors** tab of Trace Optimization. > > 4. On the **Manage behaviors** page, in the **Main layer** pane, select a main > behavior from the dropdown. > > 5. Optional: In the **Override layer** pane, select an override behavior and choose > the override start and end time, and select a duration for how long the > override remains active. > > 6. Select a shaping order for your main behavior. Shaping order is in decreasing > priority, so a behavior in position one takes precedence over a behavior in > position three. > > The shaping order section indicates the percentage of overlap between datasets so > you can better understand the impact to traces in other datasets. > > 7. Click **Save** to save the behavior definition for your dataset. > [tab] Chronoctl > > > [!NOTE] > > > > If you don't already have a YAML configuration file, use the `scaffold` Chronoctl > > parameter to generate a template for a specific resource type: > > > > ```shell theme={null} > > chronoctl trace-behavior-config scaffold > > ``` > > > > You can redirect the results (using the redirection operator `>`) to a file for > > editing. > > To assign a behavior with [Chronoctl](/tooling/chronoctl): > > 1. Run the following command to generate a sample behavior configuration you can use > as a template: > > ```shell theme={null} > chronoctl trace-behavior-config scaffold > ``` > > In the template, `kind: TraceBehaviorConfig` defines an individual dataset. > > 2. With a completed definition, submit it with: > > ```shell theme={null} > chronoctl trace-behavior-config create -f FILE_NAME > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > > See the [Chronoctl behavior example](/control/shaping/sample-traces/datasets#chronoctl-behavior-example) > for a completed behavior definition. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateTraceBehaviorConfig`](/tooling/api-info/definition/operations/UpdateTraceBehaviorConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Preview behaviors When viewing a dataset in Cortex XCOR, you can select a different behavior from the active behavior and preview its effects on the data volume of the selected dataset. This lets you temporarily preview a behavior to understand its impact before assigning it. On-call engineers can use this feature to show that a temporary override won't consume your organization's entire tracing license, which can let an administrator promote the preview behavior with confidence. When you preview a behavior, it runs for up to seven days or until you stop the preview. Preview behaviors don't shape datasets until you promote them. When promoted, preview behaviors inherit the same shaping order as your active behaviors. If no behaviors are active for the selected dataset for which you're previewing a behavior, the shaping order defaults to one, which is the highest priority. > [!NOTE] > > If you use datasets with tail sampling rules but have no active behaviors, any > behaviors that you preview will default to shaping order `1` until you assign > behaviors to your datasets. To preview behaviors: 1. In the navigation menu, click ** Go to admin view** and then select ** Optimization > Trace Optimization**. 2. On the **Overview** tab, select the dataset you want to preview a behavior for. 3. On the selected dataset page, under **Preview behavior**, select the behavior you want to preview. 4. Click **Start** to start the preview. The preview starts running, and the volume license consumption charts display a dotted line indicating the effect of the preview if it's promoted. It can take up to two minutes before the dotted line displays on each of the charts. > [!NOTE] > > You might need to zoom in on the graphs to the current day or the last few minutes > for the dotted line to display. 5. To stop the preview, click **Stop**. When previewing a behavior, an administrator can promote it. To promote the preview behavior, click **Promote** and then select one of these options: * **Main**: sets the preview behavior as the primary behavior for the dataset. * **Override**: sets the preview behavior as a temporary override for the main behavior. ## Customize your sampling strategy You can edit the facets of the baseline behavior to modify the tail sampling strategy you want to apply to your datasets. There are two main parts of the tail sampling strategy with different facets you can modify: drop less interesting, low-value traces and keep more interesting, high-value traces. * *Less interesting traces* might be ones that denote success. These traces indicate that your app is working as designed, but you likely don't need to keep most of them. * *More interesting traces* might be error traces, which indicate an issue that requires attention. Keeping more interesting traces helps when you're debugging issues and need to identify the source of the problem. There are several facets you can configure: * **Failed traces**: Traces containing root spans that have a status set to `Error`, as defined by the OpenTelemetry [span status](https://opentelemetry.io/docs/concepts/signals/traces/#span-status). * **Small traces**: Traces with very few spans that often indicate repeated messages about successful operations or incomplete instrumentation. * **Large traces**: Traces that are difficult to parse because of their large size, and which are rarely used in incident debugging due to a high ratio of noise to signal. These traces also consume a large amount of the persistence budget. * **Slow traces**: Traces that take a long time to complete, which can indicate issues in a related operation or service. * **Fast traces**: Traces that complete very quickly, which can be either repeated messages about successful operations or incomplete traces. Although each part of the baseline sampling strategy includes a set of facets by default, you can move facets from the low-value section to the high-value section, and the reverse. You can select the number of spans to keep, the duration for slow and fast traces, and the sampling rate for each facet. This flexibility lets you shape your sampling strategy as you learn more about your trace data and determine what information is valuable to your organization, and what isn't. You can disable some of the facets if you don't want to use them in your baseline strategy. For example, you don't want to keep most of your successful traces because you know they're successful, and you want to sample only a portion of your very small traces. In the **Default** section of the sampling strategy, you set the sample rate to 0.1%, and then set the sample rate for small traces to 10%. In the high-value section of the sampling strategy, you define the criteria for the traces you want to keep. The facets for this part of the strategy might include failed traces, large traces, and slow traces. When you assign your customized baseline behavior to a dataset, Cortex XCOR applies the following match criteria in order: 1. All traces in the dataset get matched against the behavior's low-value trace criteria. If a trace meets one or more of these criteria, the lowest possible sample rate applies. 2. All remaining traces in the dataset get matched against the high-value trace criteria. If a trace meets one or more of these criteria, the highest possible sampling rate applies. 3. If a trace doesn't match either of these criteria, the sample rate specified in the **Default** section applies. When viewing [span details](/investigate/querying/traces/features#span-details) in Trace Explorer, use the `tail_sampling_rate` tag on the root span of the trace to determine the tail sampling rate for the entire trace. The rate can be in a range of `0` to `1`, expressed as a decimal percentage. For example, a `tail_sampling_rate` of `0.01` equates to 1%, whereas a value of `0.25` equates to 25%. In the **Span details** section of Trace Explorer, use this tag in conjunction with the `behavior_dataset_slug` tag to understand which [dataset](/control/shaping/sample-traces/datasets) a trace inherits its sampling rate from. ### Edit the baseline behavior > [!NOTE] > > You can edit facets of the baseline behavior using the Cortex XCOR app > only. To edit the baseline behavior: 1. In the navigation menu, click ** Go to admin view** and then select ** Optimization > Trace Optimization**. 2. Click the **Behaviors** tab, and then click the **Baseline** behavior. 3. On the **Behavior details** panel, click **Edit**. 4. On the **Edit baseline behavior** panel, define your sampling methodology: * **Head sampling**: Specify the sample rate for head sampling to capture only a portion of possible traces from originating services. > [!NOTE] > > To specify a sample rate for head sampling in the baseline behavior, you must > instrument [head sampling](/control/shaping/sample-traces/head-sampling) first. * **Tail sampling**: Specify the sample rate for each of the facets to drop low-value traces and keep high-value traces. Enable which facets to include in your tail sampling strategy, and specify a sampling rate for each facet. Specific sample rates depend on how your organization configures individual services. The following recommendations are based on best practices observed across many organizations: * **Large traces**: Set the number of spans to sample to `10,000`, and set a sample rate percentage of `25` or less. Some organizations might set the number of spans to sample closer to `3,000` and set the sample rate percentage to `5`. * **Slow traces**: Set the minimum duration threshold to `5` seconds and set a sample rate between `80` percent and `100` percent. * **Failed traces**: Set the sample rate between `80` percent and `100` percent to ensure that a repository of interesting error information is available for engineers investigating a problem. * **Small traces**: Set the number of spans to sample to `2`, and set a sample rate percentage of `50` or less. * **Fast traces**: Set the maximum duration threshold to `0.00001` seconds and set a sample rate percentage of `50` or less. To move facets between the low-value and high-value sections of the tail sampling strategy, click the left **** or right **** arrow for each facet you enable. * **Default**: Set the sample rate percentage to a mid-range value, such as `50`. If a trace doesn't match the low or high-value criteria, then the sample rate specified in the **Default** section applies. 5. Click **Save** to save the changes to your baseline behavior. ### Create custom behaviors Cortex XCOR provides specific [trace behavior types](#trace-behavior-types) your organization can use to define your sampling strategy for trace datasets. These behaviors let you determine which traces to drop and which to keep across assigned datasets. As you learn more about your trace data, you can create custom behaviors and set different tail sampling rates for individual datasets. Custom behaviors let you modify behaviors for each dataset, ensuring that you're spending the highest portion of your budget on the most critical and relevant data. To create a custom behavior, you duplicate the baseline behavior, define the tail sampling rules to apply, and set a default sampling rate for the behavior. You can then assign the custom behavior to a dataset. > [!NOTE] > > After creating a custom behavior, you can duplicate that behavior rather than > duplicating the baseline behavior. To create a custom behavior: 1. In the navigation menu, click ** Go to admin view** and then select ** Optimization > Trace Optimization**. 2. Click the **Behaviors** tab, and take one of the following actions to display the **Duplicate behavior** dialog: * In the **Cortex XCOR managed behaviors** section, in the row for the **Baseline** behavior, click ** Duplicate**. * Click the **Baseline** behavior, and then on the **Baseline** page, click ** Duplicate**. 3. On the **Duplicate behavior** panel, enter a name and description for your custom behavior. Cortex XCOR generates a slug based on the name you enter. You can modify the slug to any alphanumeric combination, but special characters aren't supported. 4. Modify the tail sampling attributes to reflect the traces you want to drop or keep. See [edit the baseline behavior](#edit-the-baseline-behavior) for recommendations based on best practices observed across many organizations. 5. Set the default sample rate percentage. If a trace doesn't match the low or high-value tail sampling attributes you defined, then the default sample rate applies. 6. Click **Save**. After creating a custom behavior, you can [assign the behavior](/control/shaping/sample-traces/datasets#assign-behaviors) to a dataset. ### Modify custom behaviors After [creating a custom behavior](#create-custom-behaviors), you can modify its attributes. For example, you might want to modify the tail sampling strategy of a behavior as you learn more about the dataset the behavior is assigned to. To modify a custom behavior: 1. In the navigation menu, click ** Go to admin view** and then select ** Optimization > Trace Optimization**. 2. Click the **Behaviors** tab, and take one of the following actions to display the **Edit behavior** dialog: * In the **Custom behaviors** section, in the row for the behavior you want to modify, click ** Edit**. * Click the behavior you want to modify, and then on the selected behavior page, click ** Edit**. 3. Modify the tail sampling attributes to reflect the traces you want to drop or keep. See [edit the baseline behavior](#edit-the-baseline-behavior) for recommendations based on best practices observed across many organizations. 4. Click **Save**. ### Delete custom behaviors To delete a behavior that's assigned to one or more datasets, you must first assign all active and scheduled datasets to a different behavior. Cortex XCOR won't let you delete a behavior that's assigned to a dataset. To delete a custom behavior: 1. In the navigation menu, click ** Go to admin view** and then select ** Optimization > Trace Optimization**. 2. Click the **Behaviors** tab, and take one of the following actions to display the **Delete behavior** dialog: * In the **Custom behaviors** section, in the row for the behavior you want to delete, click ** Delete**. * Click the behavior you want to delete, and then on the selected behavior page, click ** Delete**. 3. On the **Delete behavior** confirmation dialog, click **Delete**. Cortex XCOR deletes the custom behavior. # Trace datasets Source: https://docs-xcor.paloaltonetworks.com/control/shaping/sample-traces/datasets Use datasets in Palo Alto Networks Cortex XCOR to map sets of traces to named groups relevant to your organization. Understanding your tracing license consumption helps identify where you're spending the most money on your tracing data. Trace *datasets* are a control mechanism that let you map sets of traces to named groups relevant to your organization, and then track processed and persisted bytes for those groups over time. For example, you might create a Shopper dataset based on data like services, operations, customer IDs, and tags that relate to your shopping app. Viewing that dataset provides a snapshot of trace data volume associated with the entire business unit related to your shopping app. > [!NOTE] > > Palo Alto Networks Cortex XCOR recommends creating one dataset per team or per environment. > Understanding data consumption for individual business units can highlight which > [sampling rules](/control/shaping/sample-traces) to adjust so you can better control your trace > data license consumption and remain within defined data limits. Datasets are part of Trace Optimization, which also includes trace behaviors and head and tail sampling rules. You need administrative access to use Trace Optimization. To access trace datasets, in the navigation menu, click ** Go to admin view** and then select ** Optimization > Trace Optimization**. When [searching traces](/investigate/querying/traces#search-optimizations) in Trace Explorer, use the **Custom tags** field in the **Query Builder** in Trace Explorer to search for the `behavior_dataset_slug` tag. This tag identifies traces that were sampled by a particular dataset's behavior during processing. A trace cam match many datasets, but will only be sampled by the behaviors on the first dataset it matched. used to determine the active behavior for sampling purposes. ## View datasets Select from the following methods to view and filter available trace datasets. > [tab] Web > > To view trace datasets: > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Trace Optimization**. > > The **Overview** tab displays your total license consumption for the selected > period, which defaults to the current month to date. This view includes graphs > that display the daily volume breakdown and the cumulative breakdown over the > current week. > > 2. Take any of the following actions to change the displayed data: > > * On either of the **Processed** or **Persisted** graphs, click the > more icon and select **Open in Metrics > Explorer** to > visualize the underlying query. > > * Toggle **Show unique volume** to display only the volume of data that doesn't > overlap with another dataset. > > * Toggle **Show dropped volume** to display only the volume of data that's being > dropped. > > 3. Use the search box to search for a specific dataset. The row for each dataset > displays, the total data volume, the percent of data overlap, and any active > behaviors. > > 4. In the datasets table, select one or more datasets to update the graphs. You can > click and drag a section of either graph to zoom in on the selected time period. > > 5. To view an individual dataset, click the name of the dataset you want to view from > the list. > > The individual dataset page includes a definition of the underlying Trace Explorer > query and the services at the root of all traces in the dataset. To view the > underlying queries, in either the **Definition** or **Root services**, click > **Search in Trace Explorer**. > [tab] Chronoctl > > To use [Chronoctl](/tooling/chronoctl) to return all trace datasets, use the > `chronoctl datasets list` command: > > ```shell theme={null} > chronoctl datasets list > ``` > > To filter for a specific trace dataset, add the `slugs` argument to the command: > > ```shell theme={null} > chronoctl datasets list --slugs SLUG > ``` > > Replace *`SLUG`* with the slug of the dataset you want to > display. > > [Use the Code Config tool](/tooling/gitops#use-the-code-config-tool) to view the > dataset's Chronoctl YAML representation. > [tab] Terraform > > [Use the Code Config tool](/tooling/gitops#use-the-code-config-tool) in Cortex XCOR to > view a dataset's Terraform representation. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`ListDatasets`](/tooling/api-info/definition/operations/ListDatasets) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Create datasets To create a dataset, define and test your trace query, and then map that query to the resource you want to create. After creating datasets, you can [assign trace behaviors](#assign-behaviors) for your datasets. Behaviors let you set sampling rates and the shaping order, which determines the order of priority behaviors to apply when there are overlapping traces with other datasets. Use one of the following methods to create a dataset. > [tab] Web > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Trace Optimization**. > 2. Click **Create dataset**. > 3. Enter a display name for your dataset, which is used to generate a default slug. > If you want the slug to be a different value, edit the **Slug** field directly. > 4. Enter comments about the dataset, such as the business unit this dataset tracks > trace data for. > 5. Define dataset match criteria to outline the query that matches traces you want > included in the dataset. You can add one or more span filters to additionally > refine the trace results. > > See [Search and filter trace data](/investigate/querying/traces) for > information about how to define an effective search for trace data. > 6. Click **View statistics** to open Trace Explorer in a new tab with your defined > query. Review the results to ensure your query returns the trace data you expect. > 7. In the **Create dataset** pane, click **Save** to create your dataset. > > Cortex XCOR creates your dataset and displays its definition. Next, > [assign trace behaviors](#assign-behaviors) for your dataset to set sampling rates. > [tab] Chronoctl > > > [!NOTE] > > > > If you don't already have a YAML configuration file, use the `scaffold` Chronoctl > > parameter to generate a template for a specific resource type: > > > > ```shell theme={null} > > chronoctl datasets scaffold > > ``` > > > > You can redirect the results (using the redirection operator `>`) to a file for > > editing. > > To create a dataset with [Chronoctl](/tooling/chronoctl): > > 1. Define a query in [Trace Explorer](/investigate/querying/traces) that represents > the data you want included in the dataset. For example, the following query > returns all traces where at least one span includes a service called > `payment-svc`, an operation that starts with `checkout`, and a tag named > `env=prod`: > > ```text theme={null} > service="payment-svc" operation=~"^payment*." tag:env=prod*" > ``` > > 2. Create a YAML definition to map the query to a dataset that represents the > business unit you want to track trace data for. > > Use the following command to generate a sample dataset configuration you can use > as a template: > > ```shell theme={null} > chronoctl datasets scaffold > ``` > > In the template, `kind: Dataset` defines an individual dataset. > > 3. With a completed definition, submit it with: > > ```shell theme={null} > chronoctl datasets create -f FILE_NAME > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > > See the [Chronoctl dataset example](#chronoctl-dataset-example) for a completed > dataset definition. > > After creating your dataset, [assign trace behaviors](#assign-behaviors) for your > dataset to set sampling rates and the shaping order, which determines the order of > priority behaviors to apply when there are overlapping traces with other datasets. > [tab] Terraform > > > [!NOTE] > > > > When you run `terraform plan` to generate an execution plan, Cortex XCOR automatically > > tests configurations that include notification policies by submitting them as dry runs. > > For details, see the > > [Terraform provider](/tooling/infrastructure/terraform#validate-plans-with-dry-runs) > > documentation. > > To create a dataset with [Terraform](/tooling/infrastructure/terraform): > > 1. Define a query in [Trace Explorer](/investigate/querying/traces) that represents > the data you want included in the dataset. For example, the following query > returns all traces where at least one span includes a service called > `payment-svc`, an operation that starts with `checkout`, and a tag named > `env=prod`: > > ```text theme={null} > service="payment-svc" operation=~"^payment*." tag:env=prod*" > ``` > > 2. Create a Terraform resource to map the query to a dataset that represents the > business unit you want to track trace data for. > > 3. Add the definition by using the `chronosphere_dataset` type, followed by a name in > a resource declaration. > > 4. Run this command to apply the changes: > > ```shell theme={null} > terraform apply > ``` > > See the [Terraform dataset example](#terraform-dataset-example) for a completed > dataset resource. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`CreateDataset`](/tooling/api-info/definition/operations/CreateDataset) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ### Identify incomplete traces You can create a dataset specifically for identifying incomplete traces, which are traces with spans that reference other spans outside of the selected trace. Incomplete traces can occur if a service is misconfigured and isn't exporting spans correctly. Cortex XCOR recommends creating at least one dataset with the Cortex XCOR-supplied `parent_missing=true` key-value pair to help identify and track changes in incomplete trace volume or trace instrumentation over time. As you add more trace instrumentation, fewer traces meet this criteria, which drives down the volume of traces in this dataset. You can also apply behaviors to this dataset to decrease the persisted volume of incomplete traces. Use one of the following examples to create a dataset for identifying incomplete traces. > [tab] Chronoctl > > ```yaml theme={null} > name: Partial Traces > slug: partial-traces > description: Track data volume for incomplete traces. > configuration: > type: TRACES > trace_dataset: > match_criteria: > span: > - match_type: INCLUDE > tags: > - key: parent_missing > value: > match: EXACT > value: true > ``` > [tab] Terraform > > ```terraform Terraform example icon="square-terminal" theme={null} > resource "chronosphere_dataset" "incomplete_traces" { > name = "Incomplete traces" > description = "Track data volume for incomplete traces." > configuration { > type = "TRACES" > > trace_dataset { > match_criteria { > span { > match_type = "INCLUDE" > tag { > key = "parent_missing" > > value { > value = "true" > match = "EXACT" > } > } > } > } > } > } > } > ``` ### Chronoctl dataset example The following YAML definition consists of one dataset named `Traces payment service US prod`. This dataset includes any spans that include the `payment` service, the `payment_store` operation, and have a tag where `deployment.environment=production`. > [!NOTE] > > If you want to specify criteria at the trace level rather than the span level, > define `trace` instead of `span` in your YAML definition. ```yaml expandable Chronoctl example icon="square-terminal" theme={null} api_version: v1/config kind: Dataset spec: # Required name of the dataset. Can be modified after the dataset is created. name: Traces payment service US prod # Unique identifier of the dataset. If not provided, a slug is generated based # on the name field. Can't be modified after the dataset is created. slug: traces-payment-service-us-prod # Optional description for the dataset. description: Traces for payment service in US production environment # Defining characteristics of the dataset. configuration: # Dataset type, which must be TRACES. type: TRACES trace_dataset: # Trace criteria to match for the dataset. match_criteria: # Object that represents the span conditions to match on. All conditions must # be true in a single span for the span to be considered a match. span: # Determines whether in INCLUDE or EXCLUDE all traces that contain at least # one span matching the filter. - match_type: INCLUDE # The service to match on in candidate spans. service: # Operator to compare in_values with. Can be one of EXACT, REGEX, # EXACT_NEGATION, REGEX_NEGATION, IN, NOT_IN. match: IN # Values the filter tests against when using IN or NOT_IN match type. in_values: - payment # The operation to match on in candidate spans. operation: match: REGEX # The value the filter compares to the target trace or span field. value: /payment_store/.* # The tag to match on in candidate spans. tags: # The key of the span tag to match on in the filter. - key: deployment.environment value: match: EXACT value: production ``` ### Terraform dataset example The following Terraform resource creates a dataset that Terraform refers to by `prod_payment_us`, and with a human-readable name of `Traces payment service US prod`. This dataset includes any spans that include the `payment` service, where the parent service matches either `us-east` or `us-west`, the parent operation begins with `/payment`, and a tag where `environment` includes `prod`. > [!NOTE] > > If you want to specify criteria at the trace level rather than the span level, > define `trace` instead of `span` in your YAML definition. ```terraform expandable Terraform example icon="square-terminal" theme={null} resource "chronosphere_dataset" "prod_payment_us" { # Required name of the dataset. Can be modified after the dataset is created. name = "Traces payment service US prod" # Optional description for the dataset. description = "Traces passing through the payment service in US production" # Defining characteristics of the dataset. configuration { # Dataset type, which must be TRACES. type = "TRACES" trace_dataset { # Trace criteria to match for the dataset. match_criteria { # Object that represents the span conditions to match on. All conditions must # be true in a single span for the span to be considered a match. span { # Matches traces based on the entire duration of the trace. duration { max_secs = 99 min_secs = 1 } # Matches traces based on the top-level error status. error { value = true } # Determines whether in INCLUDE or EXCLUDE all traces that contain at least # one span matching the filter. match_type = "INCLUDE" # Matches the operation of the candidate span's parent span if it's not a # root span. parent_operation { value = "payments/.*" match = "REGEX" } # Matches the service of the candidate span's parent span if it's not a # root span. parent_service { value = "us-[east|west]" match = "REGEX" } # The service to match on in candidate spans. service { match = "IN" in_values = ["payment"] } # Defines the number of spans that must match the criteria defined by # filter. Defaults to least one span. span_count { max = 2 min = 1 } # The tag to match on in candidate spans. tag { key = "environment" value { value = "prod.*" match = "REGEX" } } tag { key = "client_build" value { match = "NOT_IN" in_values = ["debug", "beta"] } } } } } } } ``` ## Assign behaviors When viewing an individual dataset, you can assign a [behavior](/control/shaping/sample-traces/behaviors) to the dataset to set sampling rates on two levels: * Assign a *main behavior* to define the primary behavior for a dataset. * Assign an *override behavior* to temporarily override the main behavior. > [!NOTE] > > You can assign only one main behavior and one override behavior to a dataset. Both the main and override layers can use any of the [trace behavior types](/control/shaping/sample-traces/behaviors#trace-behavior-types), which are baseline, allow, and deny. You can also [create custom behaviors](/control/shaping/sample-traces/behaviors#create-custom-behaviors) and assign them to the main or override layers on datasets. When assigning a behavior to the override layer, you can set the behavior to start immediately, or schedule it to start at a future time. When managing assigned behaviors, you can set the shaping order for overlapping trace datasets. The shaping order determines the priority order to apply behaviors when traces in one dataset overlap with traces in another dataset. For example, if a trace belongs to more than one dataset with an assigned behavior, Cortex XCOR uses the behavior assigned to the dataset that's first in the shaping order. The shaping order applies only when the selected behavior is active. > [!NOTE] > > Assigning a behavior to a dataset is different than > [editing the baseline behavior](/control/shaping/sample-traces/behaviors#customize-your-sampling-strategy), > where you can modify the facets based on the sampling strategy you want to use. Select from the following methods to assign behaviors to a dataset. > [tab] Web > > To assign behaviors to a dataset: > > > [!NOTE] > > > > You can also > > [manage assigned behaviors](/control/shaping/sample-traces/behaviors#manage-assigned-behaviors) > > from the **Behaviors** tab of Trace Optimization. > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Trace Optimization**. > > 2. From the list of datasets, click the dataset you want to manage behaviors for. > > 3. In the selected dataset page, in the **Behavior** pane, click **Manage**. > > If you already have a behavior assigned to a dataset, you can > [run a preview](/control/shaping/sample-traces/behaviors#preview-behaviors) of another > dataset to preview its affects based on a dataset's volume. This capability > lets you temporarily preview a behavior to understand its impact before assigning > it. > > 4. In the **Main layer** pane, select a main behavior from the dropdown. > > 5. Optional: In the **Override layer** pane, select an override behavior and choose > when the override should start and end, and select a duration for how long the > override remains active. > > 6. Select a shaping order for your main behavior. Shaping order is in decreasing > priority, so a behavior in position one takes precedence over a behavior in > position three. > > 7. Click **Save** to save the behavior definition for your dataset. > [tab] Chronoctl > > > [!NOTE] > > > > If you don't already have a YAML configuration file, use the `scaffold` Chronoctl > > parameter to generate a template for a specific resource type: > > > > ```shell theme={null} > > chronoctl trace-behavior-config scaffold > > ``` > > > > You can redirect the results (using the redirection operator `>`) to a file for > > editing. > > To assign a behavior with [Chronoctl](/tooling/chronoctl): > > 1. Run the following command to generate a sample behavior configuration you can use > as a template: > > ```shell theme={null} > chronoctl trace-behavior-config scaffold > ``` > > In the template, `kind: TraceBehaviorConfig` defines an individual dataset. > > 2. With a completed definition, submit it with: > > ```shell theme={null} > chronoctl trace-behavior-config create -f FILE_NAME > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > > See the [Chronoctl behavior example](#chronoctl-behavior-example) for a completed > behavior definition. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateTraceBehaviorConfig`](/tooling/api-info/definition/operations/UpdateTraceBehaviorConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ### Chronoctl behavior example The following YAML definition consists of one behavior named `Traces payment service US prod`. This dataset includes any spans that include the `payment` service, the `payment_store` operation, and have a tag where `deployment.environment=production`. ```yaml expandable Chronoctl example icon="square-terminal" theme={null} api_version: v1/config kind: TraceBehaviorConfig spec: # List of assignments for the main behavior. The referenced datasets are datasets # to enroll in behaviors. The referenced behaviors are the active behaviors # for the dataset when there is no override in place. # * Only one main behavior can be assigned to a dataset. # * Only one referenced 'TraceBehavior' with 'type' field set to 'TYPE_BASELINE' can # be set, which must match the slug referenced by 'baseline_behavior_slug'. main_behavior_assignments: - created_at: "2024-08-24T14:15:22Z" updated_at: "2024-08-24T13:22:21Z" # The slug reference of a TraceDataset dataset_slug: "shopper-dataset" # The slug reference of a TraceBehavior behavior_slug: "baseline" # The author or creator of the entry. created_by: "someone@example.com" # A description of the entry. description: "Description of the behavior" # List of assignments for the override behavior. OverrideBehaviorAssignments are used to # specify the active behavior for a dataset over a specific time range. # * Only one override behavior can be assigned to a dataset. # * Only one referenced 'TraceBehavior' with 'type' field set to 'TYPE_BASELINE' can # be set, which must match the slug referenced by 'baseline_behavior_slug', and any # baseline behavior referenced in 'main_behavior_assignments'. override_behavior_assignments: - created_at: "2024-08-24T14:15:22Z" updated_at: "2024-08-24T13:22:21Z" # The slug reference of a TraceDataset dataset_slug: "shopper-dataset" # The slug reference of a TraceBehavior behavior_slug: "keep-all" # The starting time of the override. start_time: "2024-08-26T14:15:22Z" # The ending time of the override. end_time: "2024-08-26T15:15:22Z" # The author or creator of the entry. created_by: "someone@example.com" # A description of the entry. description: "Allow all traces for one hour" # List of dataset priorities. This list specifies the order in which datasets # are considered when determining the behavior to follow for a trace. Dataset # priorities are used to break ties when a trace matches more than one dataset # with an active behavior. # * Each entry in this list must refer to the slug of an existing dataset. # * The order of the list is the order in which the datasets are considered. # * The list must contain all datasets referenced in either main_behavior_assignments # and override_behavior_assignments. # * The list may contain datasets that are not referenced in either of the # previous references. dataset_priorities: - "baseline" - "keep-all" # The baseline behavior to use for behavior assignments and base head sampling rates. # Must reference a TraceBehavior entity with type: TYPE_BASELINE. baseline_behavior_slug: "baseline" ``` ## Edit datasets When creating or editing a dataset, you can [use the Code Config tool](/tooling/gitops#use-the-code-config-tool) to view code representations of a dataset for [Terraform](/tooling/infrastructure/terraform), [Chronoctl](/tooling/chronoctl), and the [Cortex XCOR API](/tooling/api-info). The displayed code also responds to changes you make in the **Visual Editor** tab. Entities modified by Terraform and Chronoctl are viewable in Cortex XCOR, but can't be modified. Select from the following methods to edit trace datasets. > [tab] Web > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Trace Optimization**. > 2. From the list of datasets, click the dataset you want to edit. > 3. On the selected dataset page, click **Edit dataset**. > 4. Make changes to your dataset, and then click **Save**. > > Cortex XCOR saves changes to your dataset. > [tab] Chronoctl > > To edit datasets using [Chronoctl](/tooling/chronoctl): > > 1. [View the datasets Chronoctl YAML](#view-datasets). > 2. Modify its properties and apply the changes with the same process as > [Creating datasets](#create-datasets). > > Chronoctl updates the dataset if it has the same slug. > > You can also use the following process if you already have a definition file: > > 1. Update the datasets definition file. > 2. Run the following command to submit the changes: > > ```shell theme={null} > chronoctl datasets update -f FILE_NAME.yaml > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > > You can also [Use the Code Config tool](/tooling/gitops#use-the-code-config-tool) to > view the dataset's > Chronoctl YAML representation. > [tab] Terraform > > To edit datasets using [Terraform](/tooling/infrastructure/terraform): > > 1. Create or edit a Terraform file that updates the resource's existing properties. > 2. Run this command to apply the changes: > > ```shell theme={null} > terraform apply > ``` > > You can also [Use the Code Config tool](/tooling/gitops#use-the-code-config-tool) to > view the dataset's > Terraform representation. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateDataset`](/tooling/api-info/definition/operations/UpdateDataset) endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Delete datasets Select from the following methods to delete trace datasets. > [!NOTE] > > Users can modify Terraform-managed resources only by using Terraform. > [Learn more](/tooling/infrastructure/terraform#prevent-changes-to-managed-resources). > [tab] Web > > Complete the following steps before you delete a dataset: > > 1. [Remove any assigned behaviors](#assign-behaviors). > 2. Stop any active [preview behaviors](/control/shaping/sample-traces/behaviors#preview-behaviors). > > After removing any assigned behaviors and stopping active preview behaviors, delete > the dataset: > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Trace Optimization**. > 2. From the list of datasets, click the dataset you want to delete. > 3. On the selected dataset page, click **Delete dataset**. > 4. In the confirmation dialog, click **Delete** to delete the dataset. > [tab] Chronoctl > > To delete a dataset with [Chronoctl](/tooling/chronoctl), use the `chronoctl datasets delete` > command: > > ```shell theme={null} > chronoctl datasets delete SLUG > ``` > > Replace *`SLUG`* with the slug of the dataset you want to delete. > > For example, to delete a dataset with the slug `infra-example-dataset`: > > ```shell theme={null} > chronoctl datasets delete infra-example-dataset > ``` > [tab] Terraform > > To delete a resource that's managed by [Terraform](/tooling/infrastructure/terraform): > > 1. Edit your Terraform configuration file to remove the pre-existing resource > definition. > 2. Run this command to remove the resource from Cortex XCOR: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`DeleteDataset`](/tooling/api-info/definition/operations/DeleteDataset) endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. # Head sampling Source: https://docs-xcor.paloaltonetworks.com/control/shaping/sample-traces/head-sampling Learn how to configure head sampling to capture a portion of your traces from originating services. You can configure dynamic, remotely configurable [*head sampling*](https://opentelemetry.io/docs/concepts/sampling/#head-sampling) to capture only a portion of possible traces from originating services. Use head sampling rules to limit possible traces to a fraction of all possible traces. You define sampling strategies to target specific kinds of traces, focus on specific services, or concentrate on a combination of service and operation. > [!NOTE] > > Head sampling applies only to root services, which are services that appear on the > root span of a trace. Identifying root services can help identify where the most > requests to a service originate, and can inform which service to increase sampling > for to generate additional trace data. To instrument head sampling, Palo Alto Networks Cortex XCOR supports the [OpenTelemetry JaegerRemoteSampler](https://opentelemetry.io/docs/specs/otel/trace/sdk/#jaegerremotesampler) head sampling standard. To use head sampling, you must first [configure the OpenTelemetry Collector](#configure-the-opentelemetry-collector). ## View head sampling rules View head sampling rules in Cortex XCOR to understand how each rule impacts your tracing data, such as the sampling rate, rule criteria, and the impact the rule is having on your trace data volume. To return a list of defined head sampling rules without additional information, use Chronoctl. > [tab] Web > > In Cortex XCOR, each head sampling rule indicates which service or > combination of service and operation it impacts. A single rule can impact multiple > operations at different sampling rates for a specific service. > > You need administrative access to complete this task. > > To view head sampling rules: > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Trace Optimization**. > 2. Click the **Head sampling** tab. > > * The **Status** column indicates whether each rule is active or inactive. An > active status means that a client fetched the head sampling rule within the last > 30 minutes. > * The **Traces Kept** column indicates the percentage at which the current rule is > sampling your traces for the indicated service. Hold the pointer over the bar in > this column to view a description for each rule. > 3. Expand each of the configured rules to view the rule criteria and impact on your > tracing data. You can also view which operations the rule impacts for the selected > service. > 4. If a rule impacts multiple operations, use the dropdown menu to select which > operation to display impact data for. > 5. Use the search box to locate rules impacting a specific service. > [tab] Chronoctl > > To display a list of all available head sampling rules > with [Chronoctl](/tooling/chronoctl), use this command: > > ```shell theme={null} > chronoctl trace-jaeger-remote-sampling-strategies list > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`ListTraceJaegerRemoteSamplingStrategies`](/tooling/api-info/definition/operations/ListTraceJaegerRemoteSamplingStrategies) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Configure head sampling To instrument head sampling, Cortex XCOR supports the [OpenTelemetry JaegerRemoteSampler](https://opentelemetry.io/docs/specs/otel/trace/sdk/#jaegerremotesampler) head sampling standard. Cortex XCOR implements the [JaegerRemoteSampler configuration API](https://www.jaegertracing.io/docs/1.41/apis/#remote-sampling-configuration-stable), and serves sampling strategies based on the Terraform resources you define. Cortex XCOR is compatible with the [Jaeger Remote Sampling extension](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/jaegerremotesampling) to enable the OpenTelemetry Collector to act as a proxy between OpenTelemetry agents and the Cortex XCOR backend. To configure head sampling: 1. [Configure the OpenTelemetry Collector](#configure-the-opentelemetry-collector). 2. [Configure your app as an OpenTelemetry agent](#configure-your-app-as-an-opentelemetry-agent). 3. [Create head sampling rules](#create-head-sampling-rules). ### Configure the OpenTelemetry Collector > Requires OpenTelemetry Collector version 0.83 or later. Before configuring OpenTelemetry agents, you must configure the OpenTelemetry Collector to export tracing data to Cortex XCOR. 1. [Configure the OpenTelemetry Collector](/ingest/metrics-traces/otel/otel-ingest) to export tracing data to Cortex XCOR. 2. In the OpenTelemetry Collector `config.yaml` file, apply the following settings to modify the `extensions` YAML collection. Specify an `endpoint` that points to your Cortex XCOR tenant, and include the Cortex XCOR API token you created for the OpenTelemetry Collector. Cortex XCOR recommends specifying a `reload_interval` to control a local cache of your sampling strategy for the `remote` source (which is Cortex XCOR). This interval reduces the number of backend API calls the OpenTelemetry Collector makes for your instrumented agents, which helps reduce egress costs. ```yaml /TENANT/ /API_TOKEN/ theme={null} extensions: zpages: endpoint: 0.0.0.0:55679 health_check: {} pprof: {} jaegerremotesampling: source: reload_interval: 30s remote: endpoint: TENANT compression: gzip headers: API-Token: ${env:API_TOKEN} ``` * *`TENANT`*: The name of your Cortex XCOR tenant. * *`API_TOKEN`*: The API token generated from your [service account](/administer/accounts-teams/service-accounts). Cortex XCOR recommends storing your API token in a separate file or Kubernetes Secret and calling it using an environment variable, such as `$API_TOKEN`. ### Configure your app as an OpenTelemetry agent Configure your app as an [OpenTelemetry agent](https://opentelemetry.io/docs/collector/deployment/agent/) to act as a proxy for the OpenTelemetry Collector, which sends your tracing data to Cortex XCOR. Instrument your app with the OpenTelemetry SDK using the [OpenTelemetry protocol (OTLP)](https://opentelemetry.io/docs/specs/otel/protocol/). Your app sends spans to the OpenTelemetry Collector, which pulls head sampling rules from Cortex XCOR. As you update head sampling rules in Cortex XCOR, the OpenTelemetry Collector pulls the changes and transmits the updated rules to your app. ```mermaid actions={false} theme={null} --- title: Span flow with head sampling rules --- flowchart LR A["Agent (your app)" instrumented with OTLP] A -- spans --> B A -. sampling rules .-> B B[OpenTelemetry Collector] --> C[Cortex XCOR] D[Head sampling rules] D -.-> C B -.-> D ``` The implementation depends on the programming language of your app. For example, the following code from the Go implementation of OpenTelemetry, [OpenTelemetry-Go](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/samplers/jaegerremote/README.md), defines how to implement the JaegerRemoteSampler in Go: ```go /SERVICE_NAME/ /HOST_NAME/ theme={null} jaegerRemoteSampler := jaegerremote.New( "SERVICE_NAME", jaegerremote.WithSamplingServerURL("http://HOST_NAME:5778/sampling"), jaegerremote.WithSamplingRefreshInterval(10*time.Second), jaegerremote.WithInitialSampler(trace.TraceIDRatioBased(0.5)), ) tp := trace.NewTracerProvider( trace.WithSampler(jaegerRemoteSampler), // ... ) otel.SetTracerProvider(tp) ``` * *`SERVICE_NAME`*: Name of the service you're sampling, which can map to a microservice in your architecture. * *`HOST_NAME`*: Host name where your OpenTelemetry Collector is running. When configuring the Jaeger remote sampler, you must include all of these properties: * **Endpoint**: Endpoint where your OpenTelemetry Collector is running, which includes the Jaeger Remote Sampling extension that points to Cortex XCOR. * **Polling interval**: Interval at which your OpenTelemetry agents sync strategies from your OpenTelemetry Collector. * **Initial sampler**: Policy to implement from your service until the configured endpoint pulls a strategy. ## Create head sampling rules After configuring the OpenTelemetry Collector to export traces, configuring head sampling, and configuring your OpenTelemetry agents, manage your head sampling strategy using the [Terraform provider](/tooling/infrastructure/terraform) or [Chronoctl](/tooling/chronoctl). This ability means you can push strategy changes to all of your OpenTelemetry agents without modifying the JaegerRemoteSampler strategy directly. > [!NOTE] > > If you don't define a sampling strategy for a service, Cortex XCOR applies > the default sampling rate of `0.001` (0.1%) to the service. The `applied_strategy` defines your sampling strategy, and can be one of the following values: * `probabilistic_strategy`: Defines a probabilistic strategy, which samples traces from the identified service based on the `sampling_rate`. This value determines the probability of sampling any trace, and must be in the range of `0` to `1`. * `rate_limiting_strategy`: Defines a rate-limited strategy that sets the maximum number of traces to sample per second. * `per_operation_strategies`: Defines a probabilistic strategy that sets a default sampling rate, plus an upper and lower bound. > [tab] Chronoctl > > When creating your head sampling strategy with Chronoctl, consider the following > behaviors of the `slug` property: > > * If you don't provide a `slug`, Chronoctl generates one based on the `name` field. > * After creating your head sampling strategy, you can modify the `name` but can't > modify the `slug`. > * The `service_name` and `slug` must match. > > To define your head sampling strategy with [Chronoctl](/tooling/chronoctl): > > 1. Create a YAML file and define your head sampling strategy. > > > [!NOTE] > > > > Use the `chronoctl trace-jaeger-remote-sampling-strategies scaffold` command to > > generate an example resource for a head sampling rule. > > The following head sampling strategy defines a probabilistic strategy that sets a > default sampling rate for the `inventory-operation`, plus an upper and lower bound: > > ```yaml Chronoctl example icon="square-terminal" theme={null} > api_version: v1/config > kind: TraceJaegerRemoteSamplingStrategy > spec: > slug: ordering-service-sampling > name: Ordering service head sampling strategy > service_name: ordering-service-sampling > applied_strategy: > per_operation_strategies: > default_sampling_rate: 0.01 > default_lower_bound_traces_per_second: 1 > default_upper_bound_traces_per_second: 1000 > per_operation_strategies: > - operation: inventory-operation > probabilistic_sampling_strategy: > sampling_rate: 0.1 > ``` > > 2. Apply your head sampling strategy and send it to Cortex XCOR: > > ```shell /FILE_NAME/ theme={null} > chronoctl apply -f FILE_NAME.yml > ``` > > *`FILE_NAME`* is the name of your head sampling YAML file. > [tab] Terraform > > Create a head sampling rule with Terraform by using the > `chronosphere_trace_jaeger_remote_sampling_strategy` type in a `resource` > declaration. > > When managing your head sampling strategy with Terraform, Cortex XCOR recommends > defining one `resource` per microservice in your Terraform file. > > If you use the Cortex XCOR-managed JaegerRemoteSampler configuration API, you can > create and change the sampling strategies of your services by running `terraform > apply`, without having to redeploy your services or OpenTelemetry Collector. > > To define your head sampling strategy: > > 1. In your Terraform file, create your head sampling strategy. You must include > a `name`,`service_name`, and `applied_strategy`. For example: > > ```terraform Terraform example icon="square-terminal" theme={null} > resource "chronosphere_trace_jaeger_remote_sampling_strategy" "billing-service" { > name = "billing-service Jaeger Remote Sampling strategy" > service_name = "billing-service" > > applied_strategy { > probabilistic_strategy { > sampling_rate = 0.01 > } > } > } > ``` > > Refer to [this example](#terraform-example) for more information. > > 2. Apply the changes: > > ```terraform icon="square-terminal" theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`CreateTraceJaegerRemoteSamplingStrategy`](/tooling/api-info/definition/operations/CreateTraceJaegerRemoteSamplingStrategy) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ### Terraform example The following example provides a `resource` definition for three services and defines a distinct sampling strategy for each: * The first resource samples the `billing-service` service at a rate of `0.01`, which is 1% of traces. * The second resource samples at most two traces per second, per instance, from the `cart-service` service. For example, if the `cart-service` service consists of 17 pods, the expected sample of traces per second is somewhere between 0 and 34. * The third resource samples traces from the `ordering-service` service at a rate of `0.01`, or 1% of traces. If volumes are low, Cortex XCOR samples traces at least once per second. If volumes are high, Cortex XCOR stops sampling traces after reaching 1,000 traces per second. ```terraform expandable Terraform example icon="square-terminal" theme={null} resource "chronosphere_trace_jaeger_remote_sampling_strategy" "billing-service" { name = "billing-service Jaeger Remote Sampling strategy" service_name = "billing-service" applied_strategy { probabilistic_strategy { sampling_rate = 0.01 } } } resource "chronosphere_trace_jaeger_remote_sampling_strategy" "cart-service" { name = "cart-service Jaeger Remote Sampling strategy" service_name = "cart-service" applied_strategy { rate_limiting_strategy { max_traces_per_second = 2 } } } resource "chronosphere_trace_jaeger_remote_sampling_strategy" "ordering-service" { name = "ordering-service Jaeger Remote Sampling strategy" service_name = "ordering-service" applied_strategy { per_operation_strategies { default_sampling_rate = 0.01 default_lower_bound_traces_per_second = 1 default_upper_bound_traces_per_second = 1000 per_operation_strategies { operation = "notification-operation" probabilistic_strategy { sampling_rate = 0.0 } } per_operation_strategies { operation = "inventory-operation" probabilistic_strategy { sampling_rate = 0.1 } } per_operation_strategies { operation = "payment-operation" probabilistic_strategy { sampling_rate = 1.0 } } } } } ``` ## Edit head sampling rules Select from the following methods to edit head sampling rules. > [tab] Chronoctl > > To edit head sampling rules with [Chronoctl](/tooling/chronoctl): > > 1. [View the head sampling rules Chronoctl YAML](#view-head-sampling-rules). > 2. Modify its properties and apply the changes with the same process as > [creating head sampling rules](#create-head-sampling-rules). Chronoctl updates > head sampling rules if it has the same slug. > > You can also use the following process if you already have a definition file: > > 1. Update the head sampling rules definition file. > 2. Run the following command to submit the changes: > > ```shell /FILE_NAME/ theme={null} > chronoctl trace-jaeger-remote-sampling-strategies update -f FILE_NAME.yaml > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > [tab] Terraform > > To edit head sampling rules using [Terraform](/tooling/infrastructure/terraform): > > 1. Create or edit a Terraform file that updates the resource's existing properties. > 2. Run this command to apply the changes: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateTraceJaegerRemoteSamplingStrategy`](/tooling/api-info/definition/operations/UpdateTraceJaegerRemoteSamplingStrategy) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Delete head sampling rules Select from the following methods to delete head sampling rules. > [tab] Chronoctl > > To delete a head sampling rule with [Chronoctl](/tooling/chronoctl), use this > command: > > ```shell /SLUG/ theme={null} > chronoctl trace-jaeger-remote-sampling-strategies delete SLUG > ``` > > Replace *`SLUG`* with the slug of the head sampling rule you want to delete. > > For example, to delete a head sampling rule with the slug `head-sampling-prod`: > > ```shell theme={null} > chronoctl trace-jaeger-remote-sampling-strategies delete head-sampling-prod > ``` > [tab] Terraform > > To delete a resource that's managed by [Terraform](/tooling/infrastructure/terraform): > > 1. Edit your Terraform configuration file to remove the pre-existing resource > definition. > 2. Run this command to remove the resource from Cortex XCOR: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`DeleteTraceJaegerRemoteSamplingStrategy`](/tooling/api-info/definition/operations/DeleteTraceJaegerRemoteSamplingStrategy) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. # Tail sampling Source: https://docs-xcor.paloaltonetworks.com/control/shaping/sample-traces/tail-sampling Learn about how to configure tail sampling to configure filters on trace data before it's stored. You can configure *tail sampling* to apply a set of fine-grained rules after any [head sampling](/control/shaping/sample-traces/head-sampling) decisions. While head sampling allows probabilistic sampling at the start of a trace, tail sampling focuses on the result of a trace. You can implement rules to look at the downstream effects of an operation, and evaluate traces based on outcomes, such as whether an error occurred or if a trace contributed to higher latency than normal. After evaluating these rules, you can keep a higher percentage of influential traces while downsampling baseline traces. Use tail sampling to configure specific filters on trace data before it's stored, and then sample your data based on those rules. For example, you might create a rule to keep all error traces, or continue downsampling all successful traces. These types of rules help to reduce costs and limit the amount of information you need to triage when debugging issues. For more information about tail sampling, see the [Tail Sampling](https://opentelemetry.io/docs/concepts/sampling/#tail-sampling) section of the OpenTelemetry Sampling documentation page. ## View tail sampling rules In Palo Alto Networks Cortex XCOR, you can view the tail sampling rules you configured in Terraform to understand the impact of each rule on your tracing data. These impacts can include the sampling rate, the rule's criteria, and the impact of a rule on your incoming traces. Cortex XCOR evaluates each trace against each rule's trace filter, in order of precedence, until a rule matches. If a rule matches, Cortex XCOR applies the matched rule's sampling rate to the trace. If a trace doesn't match any rules, Cortex XCOR applies the default sample rate to the trace. If a default sampling rate isn't specified, Cortex XCOR keeps all traces. You need administrative access to complete this task. > [tab] Web > > To view tail sampling rules: > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Trace Optimization**. > > 2. Select the **Tail sampling** tab. The sample rate for each rule displays in the > **Traces Kept** column, in addition to the **Created** and **Updated** dates. > > Hold the pointer over the bar in the **Traces Kept** column to view a description > for each rule. > > 3. Expand each of the configured rules to view the rule criteria and impact on your > tracing data. > > 4. Use the search box to locate rules impacting a specific service or operation. > [tab] Chronoctl > > To display a list of all available tail sampling rules > with [Chronoctl](/tooling/chronoctl), use this command: > > ```shell theme={null} > chronoctl trace-tail-sampling-rules read > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`ReadTraceTailSamplingRules`](/tooling/api-info/definition/operations/ReadTraceTailSamplingRules) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Create tail sampling rules You can create tail sampling rules using the [Terraform provider](/tooling/infrastructure/terraform) or [Chronoctl](/tooling/chronoctl). You create one set of tail sampling rules as an ordered list. Rules are evaluated in match order. In your rule definition file, put broader rules at the top, such as a rule that drops any traces with [health check data](#drop-all-health-check-traces). For each rule, complete the following tasks: * Assign a human-readable `name` to identify the tail sampling rule in Cortex XCOR. * Assign a `system_name`, which provides a unique label name for the metric group that traces affected by the rule. * Define a specific filter such as `"error=true"`. * Specify a sampling rate. The defaults sampling rate is `1`, which means that Cortex XCOR stores all traces that don't match any sampling rules. Sampling rates must be a number between `0` and `1`, where a rate of `0` drops all traces, and a rate of `1` keeps all traces matching the defined filter. A sampling rate of `.5` drops half of all traces matching the filter, and keeps the other half. For a complete list of supported fields for tail sampling rules, see the [CreateTraceTailSamplingRules endpoint](/tooling/api-info/definition/operations/CreateTraceTailSamplingRules). > [tab] Chronoctl > > > Requires [Chronoctl](/tooling/chronoctl) version 1.0.0 or later. > > You can use the `trace-tail-sampling-rules scaffold` command to generate an example > tail sampling rule, and then copy the resource definition: > > ```shell theme={null} > chronoctl trace-tail-sampling-rules scaffold > ``` > > To define your tail sampling strategy: > > 1. Create a YAML file and define your tail sampling strategy. > > The following tail sampling drops all health check traces from an operation named > `/health`. The `sample_rate` of `0` drops any traces matching the defined rule. > > ```yaml Chronoctl example icon="square-terminal" theme={null} > api_version: v1/config > kind: TraceTailSamplingRules > spec: > rules: > - sample_rate: 0 > name: Drop all health checks > system_name: drop-node-health-checks > filter: > span: > - operation: > value: /health > match: EXACT > match_type: INCLUDE > default_sample_rate: > enabled: true > sample_rate: 1 > ``` > > 2. Apply your tail sampling strategy and send it to Cortex XCOR: > > ```shell /FILE_NAME/ theme={null} > chronoctl apply -f FILE_NAME.yaml > ``` > > Replace *`FILE_NAME`* with the name of your tail sampling YAML file. > [tab] Terraform > > Use Terraform to create a rule definition for tail sampling: > > 1. In your Terraform file, create a tail sampling strategy with a `resource` > declaration by using the `chronosphere_trace_tail_sampling_rules` type, followed > by a `default_sample_rate` and your `rules` definition. > > ```terraform Terraform example icon="square-terminal" theme={null} > resource "chronosphere_trace_tail_sampling_rules" "default-sampling-rules" { > default_sample_rate { > enabled = true > sample_rate = 1 > } > } > ``` > > The `default_sample_rate` must be a value between `0` and `1`, inclusive. > > Refer to [these examples](#terraform-examples) for more information. > > 2. Apply the changes: > > ```terraform icon="square-terminal" theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`CreateTraceTailSamplingRules`](/tooling/api-info/definition/operations/CreateTraceTailSamplingRules) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Edit tail sampling rules Select from the following methods to edit tail sampling rules. > [tab] Chronoctl > > To edit tail sampling rules with [Chronoctl](/tooling/chronoctl): > > 1. [View the tail sampling rules Chronoctl YAML](#view-tail-sampling-rules). > 2. Modify its properties and apply the changes with the same process as > [creating tail sampling rules](#create-tail-sampling-rules). Chronoctl updates > tail sampling rules if it has the same slug. > > You can also use the following process if you already have a definition file: > > 1. Update the tail sampling rules definition file. > 2. Run the following command to submit the changes: > > ```shell /FILE_NAME/ theme={null} > chronoctl trace-tail-sampling-rules update -f FILE_NAME.yaml > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > [tab] Terraform > > To edit tail sampling rules using [Terraform](/tooling/infrastructure/terraform): > > 1. Create or edit a Terraform file that updates the resource's existing properties. > 2. Run this command to apply the changes: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateTraceTailSamplingRules`](/tooling/api-info/definition/operations/UpdateTraceTailSamplingRules) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Delete tail sampling rules Select from the following methods to delete tail sampling rules. > [tab] Chronoctl > > To delete a tail sampling rule with [Chronoctl](/tooling/chronoctl), use this > command: > > ```shell /SLUG/ theme={null} > chronoctl trace-tail-sampling-rules delete SLUG > ``` > > Replace *`SLUG`* with the slug of the tail sampling rule you want to delete. > > For example, to delete a tail sampling rule with the slug `tail-sampling-prod`: > > ```shell theme={null} > chronoctl trace-tail-sampling-rules delete tail-sampling-prod > ``` > [tab] Terraform > > To delete a resource that's managed by [Terraform](/tooling/infrastructure/terraform): > > 1. Edit your Terraform configuration file to remove the pre-existing resource > definition. > 2. Run this command to remove the resource from Cortex XCOR: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`DeleteTraceTailSamplingRules`](/tooling/api-info/definition/operations/DeleteTraceTailSamplingRules) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Terraform examples Use the following examples to build your tail sampling strategy in Terraform. Because the tracing backend evaluates rules in match order, put expansive rules at the top of your Terraform file, such as rules that always drop or always keep specific traces. ### Default sampling rate The following example defines a default sample rate of `1`, which keeps all traces. A sample rate of `0` drops all traces that don't match any other rule. ```terraform Terraform example icon="square-terminal" theme={null} resource "chronosphere_trace_tail_sampling_rules" "default-sampling-rules" { default_sample_rate { enabled = true sample_rate = 1 } } ``` ### Drop all health check traces You might have load balancers that ping your backend servers every few seconds, which can generate a large amount of useless tracing data. In this instance, you can define a rule to drop all health check traces rather than those from a particular service. In addition to defining the default sample rate, the following rule drops all health check traces from an operation named `"/health"`. The `sample_rate` of `0` drops any traces matching the defined rule. ```terraform Terraform example icon="square-terminal" theme={null} resource "chronosphere_trace_tail_sampling_rules" "drop-node-health-checks" { default_sample_rate { enabled = true sample_rate = 1 } rules { name = "No Health Checks" system_name = "no_health_checks" filter { span { match_type = "INCLUDE" operation { match = "EXACT" value = "/health" } } } sample_rate = 0 } } ``` ### Always keep query traces with a minimum duration Requests to your app can quickly consume your licensed trace capacity. For example, user-initiated requests to a ride sharing app can amount to huge traces, especially during peak travel hours. Any time a query executes, it can generate tens or even hundreds of thousands of spans. You might only want to keep traces that exceed a specific duration or result in an error state, rather than storing the entirety of your tracing data. The following example keeps any trace with a span where the operation is `"/hail-ride"`, and the overall duration of the trace is greater than five seconds. This rule lets you store long-running traces and investigate what's causing higher latency. ```terraform Terraform example icon="square-terminal" theme={null} resource "chronosphere_trace_tail_sampling_rules" "keep-longer-traces" { default_sample_rate { enabled = true sample_rate = 1 } rules { name = "Hail Ride High Latency" system_name = "hail_ride_high_latency" sample_rate = 1 filter { span { match_type = "INCLUDE" operation { match = "EXACT" value = "/hail-ride" } } trace { duration { min_secs = 5 } } } } } ``` You can extend this rule set to also include traces to the `"/hail-ride"` operation that fail. The following rule matches any trace with at least one call to the `"/hail-ride"` operation anywhere in the trace, even if there's only one out of 1,000 spans. Cortex XCOR then keeps any traces from the `"/hail-ride"` operation where the error value is `true`. ```terraform Terraform example icon="square-terminal" theme={null} resource "chronosphere_trace_tail_sampling_rules" "keep-error-traces" { default_sample_rate { enabled = true sample_rate = 1 } rules { name = "Non-200 HTTP status, USA only" system_name = "non_200_http_status_usa" sample_rate = 1 filter { span { match_type = "INCLUDE" operation { match = "EXACT" value = "/hail-ride" } } trace { error { value = true } } } } } ``` ### Match on services in specific regions You might want to keep a percentage of traces from particular services that match certain conditions. For example, always keep a sample of traces from the `billing-svc` service in the `us-east` or `us-west` regions that have a specific duration. This ability to hone your sampling rules provides finer control over which tracing data you keep and pay for. The following example defines a `resource` definition with specified rules that matches two tags: * Matching a tag where the key is `region` and the values are either `us-east` or `us-west`. The example uses the `REGEX` operator to match either of the specified values. * Matching a tag where the key is `http.status_code` and the value doesn't match `200`. The example uses the `NOT_EQUAL` comparison operator to achieve this evaluation. Cortex XCOR applies the `sample_rate` of `0.6` to any traces matching that key-value pair and the additional specified criteria, such as `duration`, `error`, `operation`, and `service`. ```terraform expandable Terraform example icon="square-terminal" theme={null} resource "chronosphere_trace_tail_sampling_rules" "tail-sampling-rules" { default_sample_rate { enabled = true sample_rate = 0.5 } rules { name = "Non-200 HTTP status, USA only" system_name = "non_200_http_status_usa" filter { span { match_type = "INCLUDE" tag { key = "region" value { match = "REGEX" value = "(us-east|us-west)" } } tag { key = "http.status_code" numeric_value { comparison = "NOT_EQUAL" value = "200" } } duration { max_secs = 16 min_secs = 11 } error { value = true } operation { match = "EXACT" value = "execute-charge" } parent_operation { match = "EXACT" value = "execute-purchase" } parent_service { match = "EXACT" value = "purchase-svc" } service { match = "EXACT" value = "billing-svc" } span_count { min = 2 max = 4 } } trace { duration { min_secs = 10 max_secs = 15 } error { value = false } } } sample_rate = 0.6 } } ``` ### Nested tail sampling rules You can nest tail sampling rules by adding multiple `rules` definitions. The following example includes individual rules that match on different tags: * The `Reduce prod to 5 percent` rule matches a tag where the key is `BillingEnvironment` and the value is `production`. The sample rate is `0.05`, which samples 5% of traces matching this rule. * The `Exclude API status traces` rule matches a tag where the key is `Operation` and the value is `/api/status`. The sample rate is `0`, which drops all traces matching this rule. If traces match neither of these rules, Cortex XCOR applies the default rule, which is to keep all traces. ```terraform expandable Terraform example icon="square-terminal" theme={null} resource "chronosphere_trace_tail_sampling_rules" "two-tail-sampling-rules" { default_sample_rate { enabled = true sample_rate = 1 } rules { name = "Reduce prod to 5 percent" system_name = "reduce_prod_to_5percent" sample_rate = 0.05 filter { span { match_type = "INCLUDE" tag { key = "BillingEnvironment" value { match = "EXACT" value = "production" } } } } } rules { name = "Exclude API status traces" system_name = "exclude_api_status_operations" sample_rate = 0 filter { span { match_type = "INCLUDE" tag { key = "Operation" value { match = "EXACT" value = "/api/status" } } } } } } ``` # Trace Metrics Source: https://docs-xcor.paloaltonetworks.com/control/shaping/sample-traces/trace-metrics Learn about how to create and use trace metrics to help address issues. Use Trace Explorer to identify the root cause of an issue. As you define your query and determine what caused the problem you're investigating, you can create a *trace metric* from your query to display that metric in a dashboard for faster discovery. You can then configure monitors and alerts on that metric to notify other on-call engineers if that metric identifies anomalies in your trace data. This ability to navigate from a trace metric to a specific query in Trace Explorer helps other on-call engineers address problems faster by using predefined queries to explore issues. Use the following metric types to help track information for collected traces: * **Counter metric**: Increments any time a trace that matches a filter gets collected. This metric also includes a label describing whether or not the trace contains an error. * **Histogram metric**: Collects information about the distribution of request durations for traces that match a filter. Palo Alto Networks Cortex XCOR provides a default **Trace Metrics** dashboard with panels that display the requests, errors, and durations of requests associated with a created trace metric. The dashboard also includes a service map of the requests. Cortex XCOR generates any trace metrics you've created before applying behaviors or [tail sampling rules](/control/shaping/sample-traces/tail-sampling), which determine whether to persist the trace. To explore tracing data in Cortex XCOR, you must either install and configure the [Chronosphere Collector](/ingest/metrics-traces/collector/install/tracing) or the [OpenTelemetry Collector](/ingest/metrics-traces/otel/otel-ingest) to receive trace data from your services. ## View existing trace metrics You can view trace metrics in Cortex XCOR and open the related query in Trace Explorer. To return a list of defined trace metrics without additional information, use Chronoctl. > [tab] Web > > Viewing a trace metric opens the related query in Trace Explorer. Cortex XCOR takes the > contextual information in metrics from a dashboard and uses it to > build links to search for traces. Clicking the link opens Trace Explorer and replaces > the variables with matching criteria defined in the link. > > To view your existing trace metrics: > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Trace Metrics**. > 2. In the **Rule Name** column, click the name of a trace metric to view the dashboard > for that metric. > 3. From the dashboard, click anywhere in one of the graph panels to pin that > selection. In the pinned popup, click the and then click the > three vertical dots icon and choose one of these > options: > > * **Analyze anomaly (DDx)** opens > [Metrics Differential Diagnosis (DDx)](/investigate/analyze/differential-diagnosis/metrics) > and identifies labels and values that strongly correlate to the trace metric. > * **View similar logs** opens Logs Explorer with results filtered to the selected > trace metric. > * **View similar traces** opens Trace Explorer with results filtered to the > selected trace metric. > > See [common panel elements](/observe/dashboards/panels#common-panel-elements) for an > explanation of the other available tools. > [tab] Chronoctl > > To view a list of all available trace metrics using [Chronoctl](/tooling/chronoctl), > use the `chronoctl trace-metrics-rules list` command: > > ```shell theme={null} > chronoctl trace-metrics-rules list > ``` > > A complete list of the available trace metrics displays in your terminal. > > To view a single trace metrics rule, use the `chronoctl trace-metrics-rules read` > command, followed by the slug of the rule you want to view. For example, the > following command returns a trace metrics rule with the slug `telemetry-sdk`: > > ```shell theme={null} > chronoctl trace-metrics-rules read telemetry-sdk > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`ListTraceMetricsRules`](/tooling/api-info/definition/operations/ListTraceMetricsRules) > endpoint. > > To view a single trace metrics rule instead of a complete list of rules, use the > [`ReadTraceMetricsRule`](/tooling/api-info/definition/operations/ReadTraceMetricsRule) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Create a trace metric Cortex XCOR uses trace queries as the basis for trace metrics. You define a search query in Trace Explorer, and create a trace metric based on the matching criteria. You can search for any labels you add to your trace metric in [Metrics Explorer](/investigate/querying/metrics/explorer) when investigating query requests and responses. > [!WARNING] > > Creating a trace metric is the same as creating a new metric in your system. Any trace > metrics you create impact your metrics license consumption, which display in the > [License Overview](/observe/dashboards/managed-dashboards#licensing-dashboards). > > Because of that potential impact, avoid including high cardinality dimensions in your > trace metric. As a protective measure, trace metrics capture data for only the first > 1,000 unique series observed. > > Selecting a dimension to group by with high cardinality can overflow the 1,000 value > trace metric cardinality limit, and cause incorrect data to display in your trace > metric dashboard. > [tab] Web > > To create a trace metric, you must have administrative privileges. > > To create a new trace metric: > > 1. In the navigation menu select ** Explorers > Trace Explorer**. > > 2. Apply one or more filters to > [define a search](/investigate/querying/traces#define-a-search). Trace > Explorer applies the filters represented in the query before updating metrics for > the created trace metric. > > You can group your trace query search results by up to > [three dimensions](/investigate/querying/traces#group-and-narrow-results) > that can include service, operation, and any other span tag. Dimensions to group > by are inherited from the defined search query. > > > [!NOTE] > > > > Trace metrics don't support regular expression operators, such as the match (`=~`) > > or doesn't match (`!~`) operators. > > 3. Click the three vertical dots icon, and then select > **Create Trace Metric**. > > 4. In the **Create trace metric** dialog, enter a display name (the equivalent of > Prometheus metric `__name__`) and system name (the trace metric **Rule Name**) for > your trace metric. > > 5. In the **Group by labels** section, enter a metric label to display the aggregated > results of your query grouped by that attribute. > > For each dimension in the **Group by labels** field, you must define a metric > label key. Use the same key as the span tag, or a key that aligns with your > existing metrics data. Cortex XCOR adds metric label keys to your trace > metric, and associates the label value with the span tag. > > For example, if you group your query by the span tag **Service** and enter > **container\_service** as the label key, Cortex XCOR adds a label to > your trace metric where the label values equal the span tag **Service** > values. You can then query by that label anywhere you search for metric labels, > such as in Metrics Explorer or Telemetry Usage Analyzer. > > 6. Optional: Expand the **Static metric labels** section and enter key-value pairs to > add static labels to your trace metric. Static labels are like metadata you add to > your trace metric. > > 7. Click **Create**. > > After creating the trace metric, the **Trace Metric Created** dialog displays. > > It can take several minutes for the dashboard to display data about the trace > metric. > > 8. Click **Go to Trace Metrics** to view the list of available trace metrics. When > your trace metric is available, you can select it from this list to view a > dashboard for the trace metric that includes requests, errors, durations, and a > topology map. > > 9. When viewing your trace metric, click a data point in any of the provided graphs > and then click **Query Traces** to open Trace Explorer with the query you defined > for your trace metric. > [tab] Chronoctl > > When creating your trace metric with Chronoctl, consider the following behaviors of > the `slug` property: > > * If you don't provide a `slug`, Chronoctl generates one based on the `name` field. > * You can modify the `name` after creating your trace metric, but can't > modify the `slug`. > * The `metric_name` and `slug` must match. > > To use [Chronoctl](/tooling/chronoctl) to create a trace metric, use the > `chronoctl trace-metrics-rules` command: > > ```shell theme={null} > chronoctl trace-metrics-rules scaffold > ``` > > 1. Run the following command to generate a sample trace metric configuration you can > use as a template: > > ```shell theme={null} > chronoctl trace-metrics-rules scaffold > ``` > > In the template, `kind: TraceMetricsRule` defines an individual trace metric. > > You can redirect the results (using the redirection operator `>`) to a file for > editing. > > 2. With a completed definition, submit it with: > > ```shell /FILE_NAME/ theme={null} > chronoctl trace-metrics-rules create -f FILE_NAME > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > > See the [Chronoctl example](#chronoctl-trace-metric-example) for a completed trace > metrics resource. > [tab] Terraform > > > [!NOTE] > > > > When you run `terraform plan` to generate an execution plan, Cortex XCOR automatically > > tests configurations that include notification policies by submitting them as dry runs. > > For details, see the > > [Terraform provider](/tooling/infrastructure/terraform#validate-plans-with-dry-runs) > > documentation. > > To create a new trace metric with [Terraform](/tooling/infrastructure/terraform): > > 1. Create or edit a Terraform file and add the definition by using the > `chronosphere_trace_metrics_rule` type, followed by a name in a resource > declaration. > > Refer to [Trace metric rule fields](#trace-metric-rule-fields) for a list of all > supported fields. > > 2. Run this command to apply the changes: > > ```shell theme={null} > terraform apply > ``` > > See the [Terraform example](#terraform-trace-metric-example) for a completed trace > metric resource. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`CreateTraceMetricsRule`](/tooling/api-info/definition/operations/CreateTraceMetricsRule) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ### Chronoctl trace metric example The following resource defines a trace metric that matches spans that includes both the `ordering-svc` and the `POST/submit-order` operation, a tag of `env=production`, and a duration between two and three seconds. The metric also groups by the `ordering-svc` key. Use the `scope_filter` field to add a secondary layer of filtering after the initial trace metrics filter. This additional filtering is comparable to using the [span statistics](/investigate/querying/traces/features#span-statistics) feature in Trace Explorer to return information about specific spans within the specified trace filter. ```yaml expandable Chronoctl example icon="square-terminal" theme={null} api_version: v1/config kind: TraceMetricsRule spec: name: Ordering service uswest1 error traces slug: ordering-service-uswest1-error-traces metric_name: order-svc-uswest1-errors group_by: - label: svc key: named_key: ordering-svc type: SERVICE trace_filter: span: - tags: - key: env value: value: production match: EXACT operation: value: POST/submit-order match: EXACT service: value: ordering-svc match: EXACT trace: duration: min_secs: 2 max_secs: 3 error: value: true scope_filter: span_scopes: - service: value: ordering-svc match: EXACT match_type: INCLUDE - operation: value: /ordering.Ordering/Checkout match: EXACT - duration: min_secs: 2 ``` ### Terraform trace metric example The following Terraform resource definition defines a trace metric that matches spans that include both the `ordering-svc` and the `POST/submit-order` operation, a tag of `env=production`, and a duration between two and three seconds. The metric also groups by the `ordering-svc` key. Use the `scope_filter` field to add a secondary layer of filtering after the initial trace metrics filter. This additional filtering is comparable to using the [span statistics](/investigate/querying/traces/features#span-statistics) feature in Trace Explorer to return information about specific spans within the specified trace filter. ```terraform expandable Terraform example icon="square-terminal" theme={null} resource "chronosphere_trace_metrics_rule" "ordering_service_metric" { name = "Ordering service uswest1 error traces" metric_name = "order-svc-uswest1-errors" group_by { label = "svc" key { type = "SERVICE" named_key = "ordering-svc" } } trace_filter { span { tag { key = "env" value { value = "production" match = "EXACT" } } operation { value = "POST/submit-order" match = "EXACT" } service { value = "ordering-svc" match = "EXACT" } } trace { duration { min_secs = 2 max_secs = 3 } error { value = true } } scope_filter { span_scopes { service { value = "ordering-svc" match = "EXACT" } match_type = "INCLUDE" } } } } ``` ## Update a trace metric Select from the following methods to update trace metrics. > [tab] Web > > To update a trace metric, you must have administrative privileges. > > To edit or update a trace metric: > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Trace Metrics**. > 2. To the right of the date of the trace metric, click the > three vertical dots icon, and then click **Edit**. > 3. In the **Edit trace metric** dialog, edit the query that generates the trace > metric or make any other needed changes. > 4. Click **Save** to save your changes. > [tab] Chronoctl > > To update a trace metric using [Chronoctl](/tooling/chronoctl): > > 1. Return a list of all available trace metrics: > > ```shell theme={null} > chronoctl trace-metrics-rules list > ``` > > 2. Modify the YAML file for the trace metrics you want to update. > > 3. Apply your changes: > > ```shell theme={null} > chronoctl apply -f FILE_NAME.yaml > ``` > > Replace *`FILE_NAME`* with the name of your trace metric YAML file. > > Chronoctl updates the trace metric's properties if it has the same slug. > [tab] Terraform > > To edit a trace metric using [Terraform](/tooling/infrastructure/terraform): > > 1. Modify the resource's existing properties. > 2. Run `terraform apply` to apply the changes. > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateTraceMetricsRule`](/tooling/api-info/definition/operations/UpdateTraceMetricsRule) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Delete a trace metric Select from the following methods to delete trace metrics. > [tab] Web > > To delete a trace metric, you must have administrative privileges. > > To delete a trace metric: > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Trace Metrics**. > 2. To the right of the date of the trace metric, click the > three vertical dots icon, and then click **Delete**. > [tab] Chronoctl > > To delete a trace metric using [Chronoctl](/tooling/chronoctl): > > 1. Return a list of all available notification policies: > > ```shell theme={null} > chronoctl trace-metrics-rules list > ``` > > 2. Run the following command to delete the trace metric: > > ```shell theme={null} > chronoctl trace-metrics-rules delete SLUG > ``` > > Replace *`SLUG`* with the slug of the trace metric you want to delete. > > Chronoctl deletes the trace metric with the specified slug. > [tab] Terraform > > To delete a resource that's managed by [Terraform](/tooling/infrastructure/terraform): > > 1. Edit your Terraform configuration file to remove the pre-existing resource > definition. > 2. Run this command to remove the resource from Cortex XCOR: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`DeleteTraceMetricsRule`](/tooling/api-info/definition/operations/DeleteTraceMetricsRule) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. Cortex XCOR removes the metric from the **Trace Metrics** page. Deleting a trace metric also removes access to the metric in the Trace Metrics dashboard. ## Trace metric rule fields A trace metric rule consists of the following fields, which are properties of the `trace_metrics_rule` object. Each field is required unless otherwise noted. See the [CreateTraceMetricsRule](/tooling/api-info/definition/operations/CreateTraceMetricsRule) API for a complete list of supported fields. * `group_by`: Labels for grouping and narrowing search results to specific attributes. See [Group and narrow results](/investigate/querying/traces#group-and-narrow-results) for more information about grouping related attributes. * `key`: The key to group by. * `named_key`: The name of the key to group by. * `type`: The type of key to group by. * `label`: The dimension for displaying the aggregated results of your query grouped by that attribute in resulting trace metrics. Defaults to the selected service. * `histogram_buckets_seconds`: Optional: An array of custom buckets measured in seconds for duration histogram metrics. You can set these if the default buckets aren't appropriate for your data. The default buckets are `[0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10]`. * `metric_labels`: Optional: Static labels applied to the metrics, defined as an object of one or more label name-value pairs. * `metric_name`: The metric's name as stored in the metrics database. Use this name to refer to the metric in PromQL queries, such as in dashboards, monitors, and the Metrics Explorer. The `metric_name` must follow [Prometheus metric naming rules](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels). Although you can modify the `metric_name` after creation, any data points generated *before* the name change aren't renamed. The new metric name is instead used to generate new data points starting from that point in time. The old metric name doesn't add new data, but you can still query it for past data points. * `name`: The name of the trace metric rule. You can modify this name after creating the trace metric rule. * `slug`: Optional: The slug for the trace metric rule. After you create the rule, the slug is immutable. If omitted, Cortex XCOR generates a `slug` at creation time that's based on the `name`. * `trace_filter`: A filter object that evaluates traces against several criteria and emits metrics for only those that match. The filter's capabilities are similar to the filter in the [Trace Explorer](/investigate/querying/traces), except it supports only exact matches on string fields instead of regular expressions. This object supports additional [optional object fields](#optional-trace-filter-object-fields). ### Optional trace filter object fields The required `trace_filter` object supports the following optional fields, and you can use any combination of them: > [!NOTE] > > Unlike most Terraform resources, several child fields of `trace` and `span` are > objects with a single field named `value`. * `trace`: Applies trace-level filtering. You can specify only one trace filter. * `duration`: Matches traces with a specified duration. You can specify only one of `min_secs` and `max_secs`. * `min_secs`: Matches traces with a duration greater than or equal to this value. * `max_secs`: Matches traces with a duration less than or equal to this value. * `error`: Object with a single field named `value`. If specified, matches traces with an error flag equal to this Boolean value. Refer to [assign values with `value`](#assign-values-with-value) for more information. * `span`: Applies span-level filtering. You can specify multiple span filters, but Cortex XCOR evaluates a trace filter match only if *all* `span` filters match. * `service`: Object with a single field named `value`. Matches spans with a service field equal to this value. Refer to [assign values with `value`](#assign-values-with-value) for more information. * `operation`: Object with a single field named `value`. Matches spans with an operation field equal to this value. Refer to [assign values with `value`](#assign-values-with-value) for more information. * `parent_service`: Object with a single field named `value`. Matches spans whose parent span's service field is equal to this value. Refer to [assign values with `value`](#assign-values-with-value) for more information. * `parent_operation`: Object with a single field named `value`. Matches spans whose parent span's operation field is equal to this value. Refer to [assign values with `value`](#assign-values-with-value) for more information. * `duration`: Matches spans with a specified duration. You can specify only one of `min_secs` and `max_secs`. * `min_secs`: Matches spans with a duration greater than or equal to this value. * `max_secs`: Matches spans with a duration less than or equal to this value. * `error`: Object with a single field named `value`. If specified, matches traces with an error flag equal to this Boolean value. Refer to [assign values with `value`](#assign-values-with-value) for more information. * `tags`: Matches based on a span's tag keys and values. You must specify the `key`, and you can specify multiple tag filters, but Cortex XCOR evaluates a span filter match only if *all* `tag` filters match. * `key`: Matches spans whose tags match the specified key. * `value`: Object with a single field named `value`. Matches spans when the tag with a matching key also matches the specified value. If omitted, Cortex XCOR evaluates *all* spans matching the key as matches. Refer to [assign values with `value`](#assign-values-with-value) for more information. * `span_count`: Specifies how many spans can match. You can set only one of `min` and `max`. By default, Cortex XCOR evaluates a `span` filter as a match only if at least one span matches. * `min`: If set, *at least* this number of spans must match the parent span filter's conditions for Cortex XCOR to evaluate the entire trace filter as a match. * `max`: If set, Cortex XCOR evaluates a trace filter match only if the number of spans matching the parent span filter's conditions is equal to or less than the `max` value. * `match_type`: Specifies the span filter's match type. Valid values are `"include"` and `"exclude"`. The `"include"` match type is the default, and evaluates a trace filter match if *all* its fields match *any* span, or multiple spans if you specify a `span_count`. An `"exclude"` match type evaluates a trace filter match if *no* spans within that trace match *all* of the span filter's conditions. ### Assign values with `value` If a child field of a `trace` or `span` are objects with a single field named `value`, assign the value to the required child `value` field of these objects, instead of directly assigning the value like a field. For example, to set the `error` field's value in a `trace` filter, use: ```terraform Terraform example icon="square-terminal" theme={null} trace { error { value = true } } ``` Also, the value of a `tag` filter, unlike the key, is also an object with a `value` field: ```terraform Terraform example icon="square-terminal" theme={null} span { tag { key = "region" value = { value = "us-east" } } } ``` Although these objects have only the one `value` field, this structure lets Cortex XCOR plan future features for these criteria. For more examples of this structure, see the [filter examples](#filter-examples). ### Filter examples Matches traces marked as `error` that also took more than five seconds: ```terraform Terraform example icon="square-terminal" theme={null} trace_filter { trace { duration { min_secs = 5 } error { value = true } } } ``` Matches traces with at least one span from the service named `"cupcake-factory"`: ```terraform Terraform example icon="square-terminal" theme={null} trace_filter { span { service { value = "cupcake-factory" } } } ``` Matches traces with at least one span tagged `region:us-east` *and* at least one span tagged `region:us-west`: ```terraform Terraform example icon="square-terminal" theme={null} trace_filter { span { tag { key = "region" value = { value = "us-east" } } } span { tag { key = "region" value = { value = "us-west" } } } } ``` Matches traces with at least one span tagged *both* `region:us-east` *and* `stack:production`: ```terraform Terraform example icon="square-terminal" theme={null} trace_filter { span { tag { key = "region" value = { value = "us-east" } } tag { key = "stack" value = { value = "production" } } } ``` Matches traces with *at least* 10 spans containing the `"db-query"` operation: ```terraform Terraform example icon="square-terminal" theme={null} trace_filter { span { operation { value = "db-query" } span_count { min = 10 } } } ``` # Shape your log data Source: https://docs-xcor.paloaltonetworks.com/control/shaping/shape-logs Learn how to use different tools in Palo Alto Networks Cortex XCOR to shape your log data and help control costs. After creating, monitoring, and adjusting [budgets](/control/consumption/budgeting) for your log data, you can use tools in Palo Alto Networks Cortex XCOR to transform, reshape, retain, or exclude data. Managing the data you persist can reduce your overall consumption, provide predictability in generated log data, and result in more performant queries when searching through logs. After sending data to Cortex XCOR, apply logic to parse, normalize, control, and format your logs before persisting the data to the database. Parsing logic and field normalization are applied before any optimization rules run. > [!NOTE] > > Prefer a guided lab? Take [Controlling Logs](/academy/courses/controlling-logs) for partitions, control rules, budgets, and > utilization analysis. ```mermaid actions={false} theme={null} flowchart LR Send["Send data"] subgraph OP["Cortex XCOR"] Parse[Parse data] Normalize[Normalize data] Optimize[Optimize data] Format[Format data] Store[Store data] end Send --> Parse --> Normalize --> Optimize --> Format --> Store click Parse "/control/shaping/shape-logs/parse-logs" click Normalize "/control/shaping/shape-logs/normalize-logs" click Optimize "/control/shaping/shape-logs/control-logs" click Format "/control/shaping/shape-logs/lookup-logs/" classDef stages fill:#007A3D,stroke:#000,stroke-width:2px,color:#FFFFFF; class Parse,Normalize,Optimize,Format stages ``` * **Parse**: To create structured logs from plaintext logs, and parse individual fields to extract meaningful data without changing your instrumentation, use [parsing](/control/shaping/shape-logs/parse-logs). * **Normalize**: To apply custom field mappings to normalize log data, use [field normalization](/control/shaping/shape-logs/normalize-logs). * **Optimize**: To drop entire logs, drop individual fields, or sample a percentage of your log data, create [optimization rules](/control/shaping/shape-logs/control-logs). * **Format**: To add context and enrich logging queries with static values, use [lookup tables](/control/shaping/shape-logs/lookup-logs). # Optimize your log data Source: https://docs-xcor.paloaltonetworks.com/control/shaping/shape-logs/control-logs Use log optimization rules to define actions for a subset of your log data that match specific criteria. Palo Alto Networks Cortex XCOR provides optimization rules that let you manage log data by transforming, reshaping, retaining, or excluding data before it's stored. These rules let you control the volume of persisted log data and improve data quality. By controlling which data you keep or drop, you can reduce noise, better control costs, and focus on data that matters most to your business. ## Applying optimization rules Optimization rules run after both [parsers](/control/shaping/shape-logs/parse-logs) and [field mappings](/control/shaping/shape-logs/normalize-logs) run. Disabled rules are skipped. [Enable rules](#enable-or-disable-optimization-rules) to have Cortex XCOR evaluate them. Cortex XCOR applies optimization rules serially and in order. Each rule operates on the output of the rule before it. Effects of previous rules apply immediately to the next rule in the sequence. If a rule matches the same condition as a previous rule, the subsequent rule operates only on the outcome of the previous rule. For example, if the first rule samples logs by 50% where `service = "auth"` and the second rule also includes this condition, the second rule evaluates only the remaining 50% of the original data volume. ```mermaid actions={false} theme={null} flowchart LR Send["Send data"] subgraph OP["Cortex XCOR"] Parse[Parse data] Normalize[Normalize data] Optimize[Optimize data] Format[Format data] Store[Store data] end Send --> Parse --> Normalize --> Optimize --> Format --> Store click Parse "/control/shaping/shape-logs/parse-logs" click Normalize "/control/shaping/shape-logs/normalize-logs" click Format "/control/shaping/shape-logs/lookup-logs/" classDef stages fill:#007A3D,stroke:#000,stroke-width:2px,color:#FFFFFF; class Optimize stages ``` Cortex XCOR includes the following optimization rules: * **Drop logs** that match a specific filter to remove unnecessary or low-value data. * **Drop fields** from logs that match specified conditions, which helps reduce the size of individual logs. If a log contains no data after fields are dropped, you can choose to drop the entire log. * **Sample logs** to retain a certain percentage of matching logs and drop the remainder, which can reduce volume and maintain visibility. * **Emit metric** converts log data to metric data. Use this optimization rule when you want to reduce the volume of logs, retain data for a longer period, and increase the speed of querying and filtering for metrics instead of logs. * **Replace field** identifies a specified field in your log data and uses a regular expression to replace any matches based on the selected replacement mode. Use this optimization rule to truncate long fields and preserve your log structure. * **Parse field** formats and splits unstructured fields into multiple fields, conditionally parses logs with similar fields based on a source field, and remaps fields. To change the order that optimization rules are applied, [reorder rules](#reorder-optimization-rules). ## View optimization rules Select from one of the following methods to view optimization rules. > [tab] Web > > To view optimization rules: > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Logs Ingest**. > > All defined optimization rules display in the **Optimization rules** section. > > 2. To view only optimization rules, from the **View** dropdown, select > **Optimization rules**. > > 3. To view the code definition for all configured optimization rules, click the > **Code config** tab. > > The **Logs optimization rules** section includes all defined optimization rules. > [tab] Chronoctl > > To use [Chronoctl](/tooling/chronoctl) to return all optimization rules, use the > `chronoctl log-control-config read` command: > > ```shell theme={null} > chronoctl log-control-config read > ``` > [tab] Terraform > > [Use the Code config tool](/tooling/gitops#use-the-code-config-tool) in Cortex XCOR > to view an optimization rule's Terraform representation. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`ReadLogControlConfig`](/tooling/api-info/definition/operations/ReadLogControlConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Create optimization rules Use optimization rules to drop certain logs at ingestion, or fields that you don't want to persist. For example, dropping log data from a specific cluster, test data in a development environment, or unnecessary individual fields across your logs. When creating optimization rules, be sure you understand how Cortex XCOR [applies optimization rules](#applying-optimization-rules). Use one of the following methods to create optimization rules for log data: > [tab] Web > > Define optimization rules in Cortex XCOR, and then > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply the rule definition. > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Logs Ingest**. > > 2. In the **Optimization rules** section, click **Create**. > > 3. In the **Create optimization rule** page, enter a name for the optimization rule. > > 4. From the **Action** menu, select the type of rule to create: > > * **Drop logs**: Completely drop logs that match the specified filter. > * **Drop fields**: Remove specific fields from logs that match the specified > filter. > * **Sample logs**: Retain a certain percentage of matching logs and drop the > remainder. > * **Emit metric**: Convert log data to metric data. > * **Replace field**: Replace context within a log field using a regular > expression. > * **Parse field**: Structure, format, or separate fields out of a source field. > > 5. Enter a filter to return log data for the optimization rule, and then press > `Ctrl+Enter` (`Command+Return` on macOS) to submit the filter. > This rule applies only to logs that match this filter at the time the log data was > ingested. > > 6. Review the returned data from the preview filter and make changes as necessary. > > > [!NOTE] > > > > Optimization rules are applied during ingestion, so the preview filter results might > > differ from a filter submitted in Logs Explorer after ingestion. By default, > > including a dot (`.`) in a filter indicates nesting within a field. > > > > In some instances, fields with a key that uses dot notation within the name, > > such as `resource.type`, must be surrounded by double quotes and brackets in the > > optimization rule filter. > > > > If a warning message displays indicating that `This filter is applied at > > ingestion` and the filter returns no results, wrap the key in double quotes > > ( `"`) and brackets (`[]`). For example, the following filter contains the > > `resource.type` key, which requires surrounding the field in double quotes and > > brackets for this particular service: > > > > ```text theme={null} > > service = "nginx" and severity = "INFO" and ["resource.type"] = "k8s_container" > > ``` > > 7. Enter additional information for the specified action: > > > [tab] Drop logs > > > > Review the filter and make changes as needed. > > > [tab] Drop fields > > > > Define the criteria for the drop rule: > > > > * In the **Parent path** field, enter the level of depth in the log to apply the > > regular expression to. For example, if you wanted to apply the regular > > expression to fields under `httpRequest`, such as `httpRequest.status`, enter > > `httpRequest` in the **Parent path** field. > > > > For fields with no nesting, leave the **Parent path** field empty. > > > > * In the **Field regex** field, enter the regular expression that determines > > which fields to match on. > > > [tab] Sample logs > > > > In the **Logs to keep** field, enter a percentage of logs you want to keep. For > > example, `25` for 25%. > > > [tab] Emit metric > > > > Define the criteria for the rule to emit metrics from logs: > > > > * Enter a unique name for the generated metric. > > * Select the metric mode for the generated metric: > > * **Counter**: A metric that counts the number of times a certain event has > > occurred. > > * **Gauge**: A metric that tracks a value which changes over time. Choose > > **Last** (most recent), **Min** (minimum value), or **Max** (maximum value) > > to define which value to use. > > * **Exponential Histogram**: A metric that tracks the distribution of values > > across data groupings with exponentially increasing size. > > * Enter a name for the log field whose value you want to use as the metric value. > > Use `field[field]` syntax to indicate nested fields. > > * Enter labels as key-value pairs to add to the metric. > > * To drop the original log, select the **Drop original log after emitting metric** > > checkbox. > > > [tab] Replace fields > > > > Define the criteria for the replace rule: > > > > * Enter the name of the log field to apply the rule to. In the **Match regex** > > field, enter the regular expression that determines which data to match on in > > the specified field. > > * Determine whether to replace the first match only (**Replace first**), or to > > replace all matches (**Replace all**). > > * Select the replacement mode: > > * **Static value**: Replace the matched content with a static string. For > > example, replace punctuation in a field with an empty string, or truncate the > > ends of long stack traces. > > * **Mapped value**: Replace the matched content with specified key-value pairs. > > For example, reduce log volume by replacing a string error with a specific > > error code. If none of the key-value pairs match, the provided default value > > is used. > > > > Click **Provide default value** to specify a default value if no matching key > > is found. > > * **Hash**: Replace the matched content with a hashed string, which can help > > reduce the size of large strings. After replacing the original content with a > > string, there's no way to recover that information. > > > [tab] Parse fields > > > > Define the criteria to parse logs: > > > > * Enter a **Source key** and optional **Destination key**. The source key is the > > field in the log whose string value you want to parse, such as `message`. The > > destination key is the field where the parsed output is written back into the > > log, such as `message.parsed`. If you don't enter a destination key, any parsed > > fields are pulled into the top level of the log. > > * Select the parser type to apply to the source key and destination key: > > > [accordion] Select parser type > > > > > > * **JSON**: The parser reads the source field's string value as a JSON object. > > > Keys and values in the JSON become fields in the output. > > > * **Regex**: Use a regular expression to match logs. In the **Template** field, > > > select the regular expression template to apply to your logs. Use a predefined > > > template such as **Nginx**, or specify a **Custom** template. > > > * **Grok**: Enter a Grok pattern to match logs. This option lets you enter > > > pre-built Grok named patterns like `%{IP:client}`, `%{NUMBER:bytes}`, > > > and `%{WORD:method}`. > > > * **Key/value**: Use a specified pattern to separate key-value pairs in log data. > > > Enter the following values: > > > * **Field delimiter**: Specifies the character used to split the input log > > > data into key-value pairs. For example, a comma (`,`) if your data is in the > > > format `key: value, key: value`. > > > * **Key/value separator**: Specifies the character used to split matching > > > pairs into its key and value. For example, a colon (`:`) if your data is in > > > the format `key: value`. > > > * **Trim characters**: Identifies the leading and trailing characters to trim > > > from the key-value pairs. For example, a space (`" "`) between key-value pairs > > > if your data is in the format `key: value, key: value`. > > * To test the parser, in the **Preview field parser** section, enter a portion > > of your log payload in the **Input** field. For example: > > > > ```text wrap theme={null} > > 192.168.1.1 - john [10/Oct/2023:13:55:36 -0700] "GET /api/users HTTP/1.1" 200 1234 > > ``` > > > > * Click **Test parser** to view a preview of the generated output after the parser > > runs. For example, the following output is generated in the **Output** section from > > the input string in the previous step: > > > > ```json theme={null} > > { > > "code": "200", > > "host": "192.168.1.1", > > "method": "GET", > > "path": "/api/users HTTP/1.1", > > "size": "1234", > > "time": "10/Oct/2023:13:55:36 -0700", > > "user": "john" > > } > > ``` > > > > * Click **Save** to save the parser definition. > > > > * On the **Logs Ingest** page, click **View code config**. > > > > * Click the **Code config** tab and > > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply > > the definition. > > 8. Click **Save** to save the optimization rule definition. > > 9. Click the **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply > the definition. > [tab] Chronoctl > > To use [Chronoctl](/tooling/chronoctl) to create optimization rules, use the > `chronoctl log-control-config create` command: > > ```shell theme={null} > chronoctl log-control-config create > ``` > > 1. Run the following command to generate a sample optimization rule configuration you can > use as a template: > > ```shell theme={null} > chronoctl log-control-config scaffold > ``` > > In the template, `kind: LogControlConfig` defines an individual optimization rule > configuration. > > 2. With a completed definition, submit it with: > > ```shell /FILE_NAME/ theme={null} > chronoctl log-control-config create -f FILE_NAME > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > > See the [Chronoctl example](#chronoctl-example) for more information. > [tab] Terraform > > > [!NOTE] > > > > When you run `terraform plan` to generate an execution plan, Cortex XCOR automatically > > tests configurations that include notification policies by submitting them as dry runs. > > For details, see the > > [Terraform provider](/tooling/infrastructure/terraform#validate-plans-with-dry-runs) > > documentation. > > To create an optimization rule with [Terraform](/tooling/infrastructure/terraform): > > 1. Create a Terraform resource with the `chronosphere_log_control_config` resource > type, followed by a resource name. > 2. Add the definition to a Terraform file. > 3. Run this command to create the resource: > > ```shell theme={null} > terraform apply > ``` > > See the [Terraform example](#terraform-example) for more information. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`CreateLogControlConfig`](/tooling/api-info/definition/operations/CreateLogControlConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ### Chronoctl example The following example defines an optimization rules file for Chronoctl, and contains the following rules: * The first rule samples 10% of logs that match the defined filter. * The second rule drops all logs for the `nginx` service of severity `INFO` where the `http.Request.status` equals `200`. * The third rule drops all `kubernetes` fields that match the defined filter. The regular expression indicates that any fields matching `kubernetes.[FIELD]` are dropped from all logs. * The fourth rule uses a mapped value to search for the `error_code` field, and replaces values based on the provided key-value pairs. If the rule matches on `INTERNAL_SERVER_ERROR`, it replaces that value with `500`. If the rule matches on `NOT_FOUND`, it replaces the value with `401`. * The fifth rule emits a counter metric from NGINX error logs. Each matching log increments `nginx_errors_total` by one. Labels on the metric come from the `service` and `error_code` log fields. * The sixth rule parses the `raw_request` field on matching NGINX access logs using a Grok pattern. The parsed fields are written to the `request` field. ```yaml expandable Chronoctl example icon="square-terminal" wrap lines highlight={6,17,22,35,52,68} theme={null} api_version: v1/config kind: LogControlConfig spec: # The ordered list of optimization rules. rules: # First rule - name: "Sample billing service with missing user ID" mode: ENABLED # Log filter syntax to select logs. Only matching logs will have control action applied. filter: "cluster_name:'production'\n AND service='billing-service'\n AND message = 'missing user ID'" type: SAMPLE sample: # Percentage of matching logs to keep. Must be in the range [0, 1]. rate: 0.10 # Second rule - name: "Drop NGINX information logs" mode: ENABLED filter: "service = 'nginx' and severity = 'INFO' and httpRequest.status = '200'" type: DROP # Third rule - name: 'Drop Kubernetes fields from development environments' mode: ENABLED filter: "namespace = 'development' and kubernetes.cluster_name = 'test'" # The configuration for a drop field action. type: DROP_FIELD drop_field: # Regular expression to match the field names to drop. field_regex: .* # Selector to indicate field path. Use 'parent[child]' syntax to # indicate nesting. parent_path: selector: kubernetes # Fourth rule - name: error replacement mode: ENABLED filter: service = "nginx" and severity = "ERROR" type: REPLACE_FIELD replace_field: field: selector: error_code replace_regex: .* replace_all: true replace_mode: MAPPED_VALUE mapped_value: pairs: - key: INTERNAL_SERVER_ERROR value: "500" - key: NOT_FOUND value: "401" # Fifth rule - name: "Emit counter for NGINX errors" mode: ENABLED filter: service = "nginx" and severity = "ERROR" type: EMIT_METRICS emit_metrics: # Prometheus-compatible metric name. name: nginx_errors_total mode: COUNTER labels: - key: service value: selector: service - key: error_code value: selector: error_code # Sixth rule - name: "Parse NGINX access log request field" mode: ENABLED filter: service = "nginx" and severity = "INFO" type: PARSE_FIELD parse_field: # The source field containing the raw request string to parse. source: selector: raw_request # The destination field where parsed structured data will be written. destination: selector: request parser: parser_type: GROK grok_parser: # Named capture groups become named fields in the extracted log. pattern: "%{WORD:method} %{URIPATHPARAM:path} HTTP/%{NUMBER:version}" ``` ### Terraform example The following example defines an optimization rules resource for Terraform, and contains the following rules: * The first rule samples 10% of logs that match the defined filter. * The second rule drops all logs for the `nginx` service of severity `INFO` where the `http.Request.status` equals `200`. * The third rule drops all `kubernetes` fields that match the defined filter. The regular expression indicates that any fields matching `kubernetes.[FIELD]` are dropped from all logs. * The fourth rule uses a mapped value to search for the `error_code` field, and replaces values based on the provided key-value pairs. If the rule matches on `INTERNAL_SERVER_ERROR`, it replaces that value with `500`. If the rule matches on `NOT_FOUND`, it replaces the value with `401`. * The fifth rule emits a counter metric from NGINX error logs. Each matching log increments `nginx_errors_total` by one. Labels on the metric come from the `service` and `error_code` log fields. * The sixth rule parses the `raw_request` field on matching NGINX access logs using a Grok pattern. The parsed fields are written to the `request` field. ```terraform expandable Terraform example icon="square-terminal" wrap lines highlight={4,24,32,51,82,110} theme={null} resource "chronosphere_log_control_config" "log_control_config" { # The ordered list of optimization rules. rules { # First rule name = "Sample billing service with missing user ID" # Log filter syntax to select logs. Only matching logs will have control action applied. filter = chomp(<<-EOF cluster_name:"rc" AND service="billing-service" AND message = "missing user ID" EOF ) mode = "ENABLED" sample { # Percentage of matching logs to keep. Must be in the range [0, 1]. rate = 0.01 } # The configuration for a drop field action. type = "SAMPLE" } rules { # Second rule name = "Drop NGINX information logs" filter = "service = \"nginx\" and severity = \"INFO\" and httpRequest.status = \"200\"" mode = "ENABLED" type = "DROP" } rules { # Third rule name = "Drop Kubernetes fields from development environments" drop_field { # Regular expression to match the field names to drop. field_regex = ".*" # Selector to indicate field path. Use 'parent[child]' syntax to # indicate nesting. parent_path { selector = "kubernetes" } } filter = "chronosphere_namespace = \"rc-logging\" and kubernetes.cluster_name = \"rc-b\"" mode = "ENABLED" type = "DROP_FIELD" } rules { # Fourth rule name = "error replacement" filter = "service = \"nginx\" and severity = \"ERROR\"" mode = "ENABLED" replace_field { field { selector = "error_code" } mapped_value { pairs { key = "INTERNAL_SERVER_ERROR" value = "500" } pairs { key = "NOT_FOUND" value = "401" } } replace_all = true replace_mode = "MAPPED_VALUE" replace_regex = ".*" } type = "REPLACE_FIELD" } rules { # Fifth rule name = "Emit counter for NGINX errors" filter = "service = \"nginx\" and severity = \"ERROR\"" mode = "ENABLED" type = "EMIT_METRICS" emit_metrics { # Prometheus-compatible metric name. name = "nginx_errors_total" mode = "COUNTER" labels { key = "service" value { selector = "service" } } labels { key = "error_code" value { selector = "error_code" } } } } rules { # Sixth rule name = "Parse NGINX access log request field" filter = "service = \"nginx\" and severity = \"INFO\"" mode = "ENABLED" type = "PARSE_FIELD" parse_field { # The source field containing the raw request string to parse. source { selector = "raw_request" } # The destination field where parsed structured data will be written. destination { selector = "request" } parser { parser_type = "GROK" grok_parser { # Named capture groups become named fields in the extracted log. pattern = "%%{WORD:method} %%{URIPATHPARAM:path} HTTP/%%{NUMBER:version}" } } } } } ``` ## Edit optimization rules When creating or editing optimization rules, you can [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to view code representations of the rules. The displayed code also responds to changes you make in the **Visual editor** tab. Select from the following methods to edit optimization rules. > [tab] Web > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Logs Ingest**. > 2. In the row of the optimization rule you want to edit, click the > three vertical dots icon and then click **Edit optimization rule**. > 3. In the **Edit optimization rule** drawer, make changes to your optimization rule, and then > click **Save**. > 4. Click the **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply > the definition. > > Cortex XCOR saves changes to your optimization rule. > [tab] Chronoctl > > To update optimization rules with [Chronoctl](/tooling/chronoctl), use the > `log-control-config update` command: > > ```shell theme={null} > chronoctl log-control-config update > ``` > > 1. Update the optimization rule definition file. > 2. Run the following command to submit the changes: > > ```shell /FILE_NAME/ theme={null} > chronoctl log-control-config update -f FILE_NAME.yaml > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > [tab] Terraform > > > [!NOTE] > > > > Users can modify Terraform-managed resources only by using Terraform. > > [Learn more](/tooling/infrastructure/terraform#prevent-changes-to-managed-resources). > > To edit optimization rules using [Terraform](/tooling/infrastructure/terraform): > > 1. Create or edit a Terraform file that updates the resource's existing properties. > 2. Run this command to apply the changes: > > ```shell theme={null} > terraform apply > ``` > > You can also [Use the Code config tool](/tooling/gitops#use-the-code-config-tool) to > view the optimization rule's Terraform representation. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateLogControlConfig`](/tooling/api-info/definition/operations/UpdateLogControlConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Reorder optimization rules Optimization rules are applied in descending order. To change the order optimization rules are applied, reorder rules. Disabled rules are skipped. > [tab] Web > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Logs Ingest**. > 2. In the **Optimization rules** section, click **Re-order rules**. > 3. In the **Edit optimization rules** drawer, in the row of the optimization rule you want to > move, click the drag indicator icon and move the > optimization rule to a different order position. > 4. Click **Save**. > 5. Click the **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply > the definition. > > Cortex XCOR saves changes to your optimization rules. > [tab] Chronoctl > > To reorder optimization rules with [Chronoctl](/tooling/chronoctl), use the > `log-control-config update` command: > > ```shell theme={null} > chronoctl log-control-config update > ``` > > 1. Update the optimization rule definition file. > 2. Run the following command to submit the changes: > > ```shell /FILE_NAME/ theme={null} > chronoctl log-control-config update -f FILE_NAME.yaml > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > [tab] Terraform > > > [!NOTE] > > > > Users can modify Terraform-managed resources only by using Terraform. > > [Learn more](/tooling/infrastructure/terraform#prevent-changes-to-managed-resources). > > To reorder optimization rules using [Terraform](/tooling/infrastructure/terraform): > > 1. Create or edit a Terraform file that updates the resource's existing properties. > 2. Run this command to apply the changes: > > ```shell theme={null} > terraform apply > ``` > > You can also [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to > view the optimization rule's Terraform representation. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateLogControlConfig`](/tooling/api-info/definition/operations/UpdateLogControlConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Enable or disable optimization rules Each rule has a mode, which can be enabled or disabled. By default, any created rule is enabled. Any rule that's enabled is applied. Disabled rules are skipped. > [tab] Web > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Logs Ingest**. > 2. In the row of the optimization rule you want to enable or disable, click the > toggle in the **Enabled** column. > 3. Click **Save**. > 4. Click the **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply > the definition. > > Cortex XCOR saves changes to your optimization rules. > [tab] Chronoctl > > To enable or disable optimization rules with [Chronoctl](/tooling/chronoctl), use the > `log-control-config update` command: > > ```shell theme={null} > chronoctl log-control-config update > ``` > > 1. In the optimization rule definition file, for the rule you want to modify, change the > current `mode`. For example, to disable a rule, change `mode: ENABLED` to > `mode: DISABLED`. > 2. Run the following command to submit the changes: > > ```shell /FILE_NAME/ theme={null} > chronoctl log-control-config update -f FILE_NAME.yaml > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > [tab] Terraform > > > [!NOTE] > > > > Users can modify Terraform-managed resources only by using Terraform. > > [Learn more](/tooling/infrastructure/terraform#prevent-changes-to-managed-resources). > > To enable or disable optimization rules using [Terraform](/tooling/infrastructure/terraform): > > 1. In the optimization rule Terraform file, change the current `mode` for the rule you > want to modify. For example, to disable a rule, change its `mode = ENABLED` to > `mode = DISABLED`. > 2. Run this command to apply the changes: > > ```shell theme={null} > terraform apply > ``` > > You can also [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to > view the optimization rule's Terraform representation. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateLogControlConfig`](/tooling/api-info/definition/operations/UpdateLogControlConfig) > endpoint. > > In the optimization rule definition, change the current `"mode"` for the rule you want > to modify. For example, to disable a rule, change its `"mode": "ENABLED"` to > `"mode": "DISABLED"`. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Delete optimization rules Select from the following methods to delete optimization rules. > [tab] Web > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Logs Ingest**. > 2. In the row of the optimization rule you want to delete, click the > three vertical dots icon and then click > **Delete optimization rule**. > 3. Click the **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply > the definition. > > Cortex XCOR deletes your optimization rule. > [tab] Chronoctl > > To delete an optimization rule with [Chronoctl](/tooling/chronoctl), use the > `chronoctl log-control-config delete` command: > > ```shell theme={null} > chronoctl log-control-config delete > ``` > [tab] Terraform > > > [!NOTE] > > > > Users can modify Terraform-managed resources only by using Terraform. > > [Learn more](/tooling/infrastructure/terraform#prevent-changes-to-managed-resources). > > To delete a resource that's managed by [Terraform](/tooling/infrastructure/terraform): > > 1. Edit your Terraform configuration file to remove the pre-existing resource > definition. > 2. Run this command to remove the resource from Cortex XCOR: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`DeleteLogControlConfig`](/tooling/api-info/definition/operations/DeleteLogControlConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. # Create lookup tables for log data Source: https://docs-xcor.paloaltonetworks.com/control/shaping/shape-logs/lookup-logs Learn how to create and modify lookup tables for log data in Palo Alto Networks Cortex XCOR. When [filtering log data](/investigate/querying/query-logs), you want to quickly retrieve results, especially when debugging an issue or responding to an incident. To help provide more meaningful results, create lookup tables in a spreadsheet (in CSV format) and upload them to Palo Alto Networks Cortex XCOR. Lookup tables store pre-calculated results or mappings between values, allowing for faster data retrieval. Use lookup tables to add context, normalize values, and enrich log data for improved filtering. For example, you can enrich severity fields with explanations, map keys like error codes to human-readable descriptions, and standardize inconsistent data. Lookup tables help you apply consistent mappings and enrichments within queries, without hard-coding large or repetitive mapping logic inline. ```mermaid actions={false} theme={null} flowchart LR Send["Send data"] subgraph OP["Cortex XCOR"] Parse[Parse data] Normalize[Normalize data] Optimize[Optimize data] Format[Format data] Store[Store data] end Send --> Parse --> Normalize --> Optimize --> Format --> Store click Parse "/control/shaping/shape-logs/parse-logs" click Normalize "/control/shaping/shape-logs/normalize-logs" click Optimize "/control/shaping/shape-logs/control-logs" classDef stages fill:#007A3D,stroke:#007A3D,stroke-width:2px,color:#FFFFFF; class Format stages ``` After uploading lookup tables, users can reference them in log queries using the [`lookup` function](/investigate/querying/query-logs/query-syntax#lookup). ## View lookup tables To view lookup tables: 1. In the navigation menu, click ** Go to admin view** and then select ** Optimization > Logs Lookup Tables**. All lookup tables are displayed. 2. To view a lookup table, click it in the list. ## Upload lookup tables To upload a lookup table in Cortex XCOR, first create a spreadsheet in CSV format. Each lookup table must be less than or equal to 10 MB. You can add up to 1,000 lookup tables. To upload lookup tables that exceed 10 MB, contact [Cortex XCOR Support](/support). To upload lookup tables: 1. In the navigation menu, click ** Go to admin view** and then select ** Optimization > Logs Lookup Tables**. 2. Click **Upload lookup table**. 3. In the **Upload lookup table** page, enter a name and description for your lookup table. Lookup table names must be unique. 4. Click **Upload CSV**, and then select the CSV file you want to upload from your local machine. 5. Click **Save** to upload your lookup table. Your lookup table displays in the list of lookup tables, and can be referenced in log queries using the [`lookup` function](/investigate/querying/query-logs/query-syntax#lookup). ## Edit lookup tables You can replace existing lookup tables by uploading a new lookup table. Replacing a lookup table overwrites the existing table. 1. In the navigation menu, click ** Go to admin view** and then select ** Optimization > Logs Lookup Tables**. 2. Click the lookup table you want to replace. 3. In the **Edit lookup table** page, click **Replace lookup table**. 4. On your local machine, select the CSV file you want to upload. 5. Click **Save** to upload your lookup table. The lookup table is replaced with the one you selected. ## Delete lookup tables To delete lookup tables: 1. In the navigation menu, click ** Go to admin view** and then select ** Optimization > Logs Lookup Tables**. 2. Click the lookup table you want to delete. 3. In the **Edit lookup table** page, click **Delete lookup table**. 4. In the confirmation window, click **Delete** to delete the lookup table. The lookup table is deleted from the list of lookup tables. # Normalize your log data Source: https://docs-xcor.paloaltonetworks.com/control/shaping/shape-logs/normalize-logs Learn how to use field mapping in Palo Alto Networks Cortex XCOR to normalize your log data at ingest time. During the ingestion phase, after parsing your data, Palo Alto Networks Cortex XCOR applies your preferred field normalization rules to populate predefined keys such as `service`, `severity`, and `timestamp`. ```mermaid actions={false} theme={null} flowchart LR Send["Send data"] subgraph OP["Cortex XCOR"] Parse[Parse data] Normalize[Normalize data] Optimize[Optimize data] Format[Format data] Store[Store data] end Send --> Parse --> Normalize --> Optimize --> Format --> Store click Parse "/control/shaping/shape-logs/parse-logs" click Optimize "/control/shaping/shape-logs/control-logs" click Format "/control/shaping/shape-logs/lookup-logs/" classDef stages fill:#007A3D,stroke:#007A3D,stroke-width:2px,color:#FFFFFF; class Normalize stages ``` This mapping provides consistency in your data, and optimizes querying in Logs Explorer. After applying these mappings, Cortex XCOR applies [optimization rules](/control/shaping/shape-logs/control-logs), and then stores your log data. In addition to these mappings, you can apply custom field mappings to normalize log data, such as normalizing values from several fields that all relate to different environments. See [Examples](#examples) for examples of how you can use custom field mappings. Custom field mappings are applied after log data is ingested, but before Cortex XCOR stores it. To indicate nesting within a source field, use a dot (`.`). For example, if your logs are in a format like `{"resource": {"labels": {"project_id": "..."}}}`, then enter `resource.labels.project_id`. If your logs already use dot notation, such as `{"resource.labels.project_id": "..."}`, enclose the selector in double quotes and brackets like `["resource.labels.project_id"]`. See [target nested or flat fields with dot notation](#target-nested-or-flat-fields-with-dot-notation) for additional examples. ## View custom field mappings Select from the following methods to view custom field mappings. > [tab] Web > > To view custom field mappings: > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Logs Ingest**. > > All field mappings display in the **Field normalization** section, including both > predefined and custom field mappings. > > 2. Choose which custom field mappings to view: > * To view an individual custom field mapping, click it in the list to open the > configuration in the **Edit field mapping** drawer. > * To view the code definition for all configured custom field mappings, click the > **Code config** tab. > [tab] Chronoctl > > To use [Chronoctl](/tooling/chronoctl) to return all custom field mappings, use this > command: > > ```shell theme={null} > chronoctl log-ingest-config read > ``` > [tab] Terraform > > [Use the Code config tool](/tooling/gitops#use-the-code-config-tool) in Cortex XCOR to > view a custom field mappings's Terraform representation. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`ReadLogIngestConfig`](/tooling/api-info/definition/operations/ReadLogIngestConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Create custom field mappings Use one of the following methods to create custom field mappings. > [tab] Web > > Define the custom field mapping definition in Cortex XCOR, and then > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply the definition. > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Logs Ingest**. > > 2. In the **Field normalization** section, click **Create**. > > 3. In the **Custom field name** field, enter the custom field name to map data to, > such as `environment`, `region`, or `userID`. > > 4. In the **Mapped fields** section, in the **Source field name** field, enter a > source field name from your log data to map to the custom field you're creating. > Fields are matched in priority order. > > To add more fields, click **Add field mapping** and then enter another source > field. > > > [!NOTE] > > > > Use a dot (`.`) to indicate nesting within a field. For example, if your logs are > > in a format like `{"resource": {"labels": {"project_id": "..."}}}`, then enter > > `resource.labels.project_id`. > > > > If your logs already use dot notation, such as `{"resource.labels.project_id"}`, > > enclose the selector in double quotes and brackets like > > `["resource.labels.project_id"]`. > > 5. Optional: In the **Default value** field, enter a default value as the mapping if > the custom field contains no values. > > 6. Optional: Select either **Regex** or **Value map** as the normalization mode. > > * **Regex**: Enter a regular expression pattern to extract and normalize values, > such as for removing extraneous data. For example, use the following regular > expression to remove prefixes and suffixes from any environments including > `production` in the name: > > ```shell theme={null} > ^.*?(production).*?$ > ``` > > * **Value map**: Enter key:value pairs to map additional metadata within your > custom field. For example, map `"warn"` to `"Warning"` and `"err"` to `"Error"` > for different severity types. > > To add more value mappings, click **Add value mapping** and then define the > value mapping. > > 7. Click **Save** to save the custom field mapping definition. > > 8. Click the **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply your > changes. > [tab] Chronoctl > > To use [Chronoctl](/tooling/chronoctl) to create custom field mappings, use this > command: > > ```shell theme={null} > chronoctl log-ingest-config create > ``` > > 1. Run the following command to generate a sample configuration you can use as a > template: > > ```shell theme={null} > chronoctl log-ingest-config scaffold > ``` > > In the template, `kind: LogIngestConfig` defines an individual log ingest > configuration. > > 2. Use the `custom_field_normalization` object to define the plain text parser to run > on your log data. > > 3. With a completed definition, submit it with: > > ```shell /FILE_NAME/ theme={null} > chronoctl log-ingest-config create -f FILE_NAME > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > [tab] Terraform > > > [!NOTE] > > > > When you run `terraform plan` to generate an execution plan, Cortex XCOR automatically > > tests configurations that include notification policies by submitting them as dry runs. > > For details, see the > > [Terraform provider](/tooling/infrastructure/terraform#validate-plans-with-dry-runs) > > documentation. > > To create a custom field mapping with [Terraform](/tooling/infrastructure/terraform): > > 1. Create a Terraform resource with the `chronosphere_log_ingest_config` resource > type, followed by a resource name. > 2. Use the `custom_field_normalization` object to define the custom field mapping to > run on your log data. > 3. Add the definition to a Terraform file. > 4. Run this command to create the resource: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`CreateLogIngestConfig`](/tooling/api-info/definition/operations/CreateLogIngestConfig) > endpoint. > > Use the `"custom_field_normalization"` object to define the custom field mapping to > run on your log data. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Edit custom field mappings When creating or editing a custom field mapping, you can [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to view code representations of a field mapping. The displayed code also responds to changes you make in the **Visual editor** tab. Select from the following methods to edit custom field mappings. After selecting a field mapping to edit, you can change the field mappings order. Fields are matched in priority order, so an order of `1` has higher precedence over an order of `6`. > [tab] Web > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Logs Ingest**. > 2. In the **Field normalization** section, click the custom field mapping you want to > edit. > 3. In the **Edit field mapping** drawer, change your custom field mapping. > 4. To reorder field mappings, drag and drop them to change the order. > 5. Click **Save**. Cortex XCOR saves changes to your custom field mapping. > 6. Click the **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply your > changes. > [tab] Chronoctl > > To update custom field mappings with [Chronoctl](/tooling/chronoctl), use this > command: > > ```shell theme={null} > chronoctl log-ingest-config update > ``` > > 1. Update the custom field mapping definition file. > 2. Run the following command to submit the changes: > > ```shell /FILE_NAME/ theme={null} > chronoctl log-ingest-config update -f FILE_NAME.yaml > ``` > > Replace *`FILE_NAME`* with the name of the YAML definition file you want to use. > [tab] Terraform > > > [!NOTE] > > > > Users can modify Terraform-managed resources only by using Terraform. > > [Learn more](/tooling/infrastructure/terraform#prevent-changes-to-managed-resources). > > To edit custom field mappings using [Terraform](/tooling/infrastructure/terraform): > > 1. Create or edit a Terraform file that updates the resource's existing properties. > 2. Run this command to apply the changes: > > ```shell theme={null} > terraform apply > ``` > > You can also [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to > view the custom field mapping's Terraform representation. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`UpdateLogIngestConfig`](/tooling/api-info/definition/operations/UpdateLogIngestConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Delete custom field mappings Select from one of the following methods to delete custom field mappings. > [tab] Web > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Logs Ingest**. > 2. In the **Edit field mapping** drawer, in the row of the field mapping you want to > delete, click the \*\*\*\* trash can icon. > 3. Click **Save** to save your changes. > 4. Click the **Code config** tab and > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply your > changes. > > Cortex XCOR deletes your custom field mapping. > [tab] Chronoctl > > To delete a custom field mapping with [Chronoctl](/tooling/chronoctl), use this > command: > > ```shell theme={null} > chronoctl log-ingest-config delete > ``` > [tab] Terraform > > > [!NOTE] > > > > Users can modify Terraform-managed resources only by using Terraform. > > [Learn more](/tooling/infrastructure/terraform#prevent-changes-to-managed-resources). > > To delete a resource that's managed by [Terraform](/tooling/infrastructure/terraform): > > 1. Edit your Terraform configuration file to remove the pre-existing resource > definition. > 2. Run this command to remove the resource from Cortex XCOR: > > ```shell theme={null} > terraform apply > ``` > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`DeleteLogIngestConfig`](/tooling/api-info/definition/operations/DeleteLogIngestConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Target nested or flat fields with dot notation The `source` selectors for custom field mappings support dot notation to read values from fields inside nested structures. How Cortex XCOR interprets a selector depends on whether you enclose the segments in brackets in double quotes: * An unbracketed dot splits the selector into path segments, which traverses nested fields. A source of `metadata.code` reads a `code` field nested inside a `metadata` object. * A bracket-quoted segment such as `["metadata.code"]` treats the quoted string as a single, literal field name that contains a dot. This reads a flat field named `metadata.code` instead of a nested structure. Consider a custom field mapping that populates a `status_code` target from a source field. To read from a nested field, set the source selector to `metadata.code`: ```json theme={null} { "target": "status_code", "normalization": { "source": [ { "selector": "metadata.code" } ] } } ``` This selector reads the value from the nested `code` field: ```json theme={null} { "metadata": { "code": "500" } } ``` To read from a single flat field whose name contains a dot, enclose the source selector in double quotes and brackets: ```json theme={null} { "target": "status_code", "normalization": { "source": [ { "selector": "[\"metadata.code\"]" } ] } } ``` This selector reads the value from one literal field name: ```json theme={null} { "metadata.code": "500" } ``` ## Examples The following examples show common `custom_field_normalization` patterns. Each object is an element of the `custom_field_normalization` array. ### Standardize and enrich data Normalize values from several fields that all relate to different environments, such as `environment` and `region`. You can then add optional mappings for individual environments, such as mapping `dev` to `development`. ```json theme={null} { "target": "environment", "normalization": { "source": [ { "selector": "env" }, { "selector": "region" } ], "default_value": "production", "value_map": { "dev": "development", "prod": "production", "stg": "staging" } } } ``` ### Consolidate values from multiple fields Map a single `region` field from whichever source field is present, checking `region` first and then `datacenter`. If neither contains a value, apply a default value. ```json theme={null} { "target": "region", "normalization": { "source": [ { "selector": "region" }, { "selector": "datacenter" } ], "default_value": "us-east-1" } } ``` ### Standardize values with a value map Normalize inconsistent HTTP status codes into a smaller set of status classes, and label anything unmatched as `unknown`. ```json theme={null} { "target": "status_class", "normalization": { "source": [ { "selector": "http.status_code" } ], "value_map": { "200": "success", "201": "success", "400": "client_error", "404": "client_error", "500": "server_error", "503": "server_error" }, "default_value": "unknown" } } ``` ### Extract a value with a regular expression Use `sanitize_patterns` to extract a substring from a larger field. Each pattern must contain exactly one capturing group, and Cortex XCOR uses that group as the result. This example extracts an uppercase log level from a free-form `message` field. ```json theme={null} { "target": "log_level", "normalization": { "source": [ { "selector": "message" } ], "sanitize_patterns": ["^.*level=([A-Z]+).*$"], "default_value": "INFO" } } ``` ### Map a value from a nested field Use dot notation to read a value from a nested structure, such as `user.id` inside `{"user": {"id": "..."}}`. Sources are still matched in priority order. ```json theme={null} { "target": "userID", "normalization": { "source": [ { "selector": "user.id" }, { "selector": "actor.userId" } ] } } ``` ### Map a value from a flat field that contains dots If a source field name already contains dots, bracket-quote the selector so Cortex XCOR treats it as one literal field name instead of a nested path. ```json theme={null} { "target": "team", "normalization": { "source": [ { "selector": "[\"kubernetes.labels.team\"]" } ], "default_value": "unassigned" } } ``` # Parse your log data Source: https://docs-xcor.paloaltonetworks.com/control/shaping/shape-logs/parse-logs Learn how to use parsers in Palo Alto Networks Cortex XCOR to shape your log data at ingest time. Your log data can be formatted differently depending on which service generates that data. Some data is structured, such as valid JSON. Other data might be somewhat structured, or not have any structure at all. In these instances, you can create parsers to create structured logs from plain text logs, and parse individual fields to extract meaningful data without changing your instrumentation. For example, if your instrumentation emits unstructured plain-text logs, create a [plain text parser](#create-plain-text-parsers) to provide structure by separating the individual fields. If your logs contain JSON or key-value pairs buried contained in a single string field, create a [field parser](#create-field-parsers) to extract the values. The extracted fields can then be queried in [Logs Explorer](/investigate/querying/query-logs) and used in aggregations and transformations. Parsers run after ingestion, but before applying normalization rules and control rules. If you want to additionally parse log data after initial parsing and normalization complete, [create an optimization rule](/control/shaping/shape-logs/control-logs#create-optimization-rules) to parse fields. ```mermaid actions={false} theme={null} flowchart LR Send["Send data"] subgraph OP["Cortex XCOR"] Parse[Parse data] Normalize[Normalize data] Optimize[Optimize data] Format[Format data] Store[Store data] end Send --> Parse --> Normalize --> Optimize --> Format --> Store click Normalize "/control/shaping/shape-logs/normalize-logs" click Optimize "/control/shaping/shape-logs/control-logs" click Format "/control/shaping/shape-logs/lookup-logs/" classDef stages fill:#007A3D,stroke:#007A3D,stroke-width:2px,color:#FFFFFF; class Parse stages ``` ## View parsers Select from the following methods to view and order available parsers. Parsers display in match order. > [tab] Web > > To view parsers: > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Logs Ingest**. > > All parsers display, including plain-text and field parsers. > > 2. To view only plain-text parsers or field parsers, from the **View** dropdown, > select **Plaintext parsers** or **Field parsers**. > > 3. To view the code definition for all configured parsers, click the **Code config** > tab. > > The **Logs parsing and mapping** section includes all defined parsers. > [tab] Chronoctl > > To use [Chronoctl](/tooling/chronoctl) to return all parsers, use the > `chronoctl log-ingest-config read` command: > > ```shell theme={null} > chronoctl log-ingest-config read > ``` > [tab] Terraform > > [Use the Code config tool](/tooling/gitops#use-the-code-config-tool) in Palo Alto Networks > Cortex XCOR to > view a parser's Terraform representation. > [tab] API > > To complete this action with the Cortex XCOR API, use the > [`ReadLogIngestConfig`](/tooling/api-info/definition/operations/ReadLogIngestConfig) > endpoint. > > Because the Cortex XCOR API requires authentication, include an API token with your > `curl` request, as shown in the following example. For more details, see > [Create an API token](/tooling/api-info#create-an-api-token). > > ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} > export CHRONOSPHERE_API_TOKEN="TOKEN" > export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io" > > curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \ > -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH" > ``` > > Replace the following: > > * *`TOKEN`*: Your API token. > * *`INSTANCE`*: The subdomain name for your organization's Cortex XCOR instance. > * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`. > * *`ENDPOINT_PATH`*: The specific endpoint you want to access. ## Create parsers Parsers operate on both [plain-text logs](#create-plain-text-parsers) and [individual fields](#create-field-parsers). All configured parsers are included in a single definition, and evaluated in match order. Cortex XCOR applies the first parser in the definition that matches a log, and ignores any subsequent parsers. Although you can define parsers in the Cortex XCOR web interface, you must [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply the definition. ### Create plain-text parsers Plain text parsers run against all ingested logs with the `plaintext` mimetype, and apply parsing logic to modify the original record. These parsers affect the entire log. Use field parsers to operate on individual fields within a log. Select either a regular expression or a key-value matching pattern to parse logs. When using a key-value pattern, you can extract any number of key value pairs from a plain text log. Plain text parsers also have an option to keep the original log after applying parsing logic. Plain text parsers apply only when the media type is set to `plaintext` for logs. Regular expressions for the matching type use [RE2 syntax](https://github.com/google/re2/wiki/Syntax) and named capture groups. Each named capture group becomes the key name in the structured log. Cortex XCOR requires at least one named capture group in the regular expression. Use one of the following methods to create plain text parsers. > [tab] Web > > Define the plain text parser definition in Cortex XCOR, and then > [use the Code config tool](/tooling/gitops#use-the-code-config-tool) to apply the definition. > > 1. In the navigation menu, click ** Go to admin view** > and then select ** Optimization > Logs Ingest**. > > 2. In the **Plaintext parsers** section, click **Create**. > > 3. Enter a name for the parser. > > 4. Select the matching type for the parser: > > * **Regex**: Use a regular expression to match logs. In the **Template** field, > select the regular expression template to apply to your logs. Use a predefined > template such as **Nginx**, or specify a **Custom** template. For example, this > regular expression is used in subsequent steps for previewing changes: > > ```text wrap theme={null} > ^(?P[^ ]*) [^ ]* (?P[^ ]*) \[(?P