• /
  • EnglishEspañolFrançais日本語한국어Português
  • EntrarComeçar agora

Query your data with NRQL

preview

We're still working on this feature, but we'd love for you to try it out!

This feature is currently provided as part of a preview program pursuant to our pre-release policies.

Query your Cloud Cost Intelligence (CCI) data with the New Relic Query Language (NRQL) to analyze your cloud spending and identify cost optimization opportunities. To run any of the queries on this page, go to one.newrelic.com > All Capabilities > Cloud Cost Intelligence and open the Query your data.

Available event types

You can query the following event types, each with a set of attributes for building detailed cost and usage queries. Event types with Full NRQL support accept any valid NRQL clause. Event types with Limited NRQL support accept only the clauses listed in Supported NRQL clauses:

Event type

Description

NRQL support

CloudSpend

One event per billing line item from your cloud provider (AWS CUR, Azure FOCUS, and GCP BigQuery), updated hourly. Use for granular, unaggregated cost analysis.

Full

KubernetesSpend

Individual Kubernetes cost allocation records from New Relic telemetry combined with billing exports, broken down by cluster, namespace, pod, and container. Use net_unblended_cost * (cpu_weightage + memory_weightage) for accurate totals.

Full

CloudCost

Billing data pre-aggregated from CloudSpend, updated hourly. Best for dashboards and trend queries.

Limited

KubernetesCost

Pre-processed Kubernetes cost data by cluster, namespace, pod, and container. Use net_unblended_cost * (cpu_weightage + memory_weightage) for accurate cost totals.

Limited

CloudCostEstimate

Real-time cost estimates generated by CCI at the resource level, including AWS instance details and metadata such as owning_team, environment, and service_name. Use for in-flight monitoring before billing data arrives.

Limited

For a complete, always up-to-date reference of the events and attributes available in your account, use the data dictionary. To write effective NRQL queries, see the Introductory NRQL tutorial.

CloudSpend

CloudSpend and CloudCost contain the same billing data from your cloud provider, but differ in their NRQL capabilities. CloudSpend supports the full NRQL language and is the recommended choice for all new queries. CloudCost supports only a subset of NRQL clauses and is planned for deprecation.

CloudSpend ingests raw billing line items from AWS Cost and Usage Reports (CUR), Azure FOCUS exports, and GCP BigQuery exports, updated hourly. It shares key attributes with CloudCost, including line_item_net_unblended_cost, line_item_product_code, and line_item_usage_account_id. For a complete attribute reference, see the data dictionary.

Example query:

FROM CloudSpend SELECT * SINCE 24 hours ago

Find your total cloud spend broken down by service over the last month:

FROM CloudSpend SELECT SUM(line_item_net_unblended_cost) FACET line_item_product_code SINCE 1 month ago

See how daily cloud spend is trending over time:

FROM CloudSpend SELECT SUM(line_item_net_unblended_cost) TIMESERIES 1 day SINCE 30 days ago

KubernetesSpend

KubernetesSpend stores individual cost allocation records for Kubernetes workloads. It combines New Relic infrastructure telemetry with cloud billing exports to break down costs by cluster, namespace, pod, and container, and supports the full NRQL language.

Because Kubernetes node costs are shared across workloads, KubernetesSpend distributes them proportionally using cpu_weightage and memory_weightage. Multiply net_unblended_cost by (cpu_weightage + memory_weightage) for accurate per-workload cost totals. For a complete attribute reference, see the data dictionary.

Example query:

FROM KubernetesSpend SELECT * SINCE 1 week ago

CloudCost

Importante

We recommend using CloudSpend for all cost and usage analysis. It provides the same billing data as CloudCost with full NRQL support.

CloudCost is a summary event generated by Cloud Cost Intelligence from cloud provider Cost and Usage Reports (CUR). It provides billing line item data including resource usage, costs, and account metadata across AWS and Azure accounts, updated hourly. Because CloudCost is pre-aggregated, it supports only a subset of NRQL clauses. For full NRQL flexibility, use CloudSpend.

Key attributes

The following attributes are most useful for building CloudCost queries:

AttributeDescription
line_item_net_unblended_costAfter-discount cost for the line item, specific to the individual account.
line_item_product_codeCloud provider service code (for example, AmazonEC2 for AWS or Virtual Machine Scale Sets for Azure).
line_item_usage_account_id12-digit AWS account ID of the account that used this line item.
line_item_usage_account_nameDisplay name of the cloud account or subscription.
line_item_unblended_costCost at standard On-Demand rates before any Reserved Instance, Savings Plan, or volume discounts.
amortised_costAmortized cost including upfront reservation or savings plan fees spread over the usage period.
is_k8sFlag indicating whether the cost is associated with a Kubernetes workload.

Example query:

FROM CloudCost SELECT * SINCE 24 hours ago
Cloud Cost Intelligence Budgets query console showing CloudCost attributes

KubernetesCost

KubernetesCost is a cost allocation event generated by Cloud Cost Intelligence. It breaks down cloud costs by Kubernetes cluster, namespace, pod, and container. This event type supports only a subset of NRQL clauses.

Key attributes

The following attributes are most useful for building KubernetesCost queries:

AttributeDescription
total_costTotal cost, calculated as the sum of cpu_costs and memory_costs.
cpu_costsPortion of the cost attributed to CPU usage.
memory_costsPortion of the cost attributed to memory usage.
net_unblended_costNet cost after discounts, based on the resource's usage share of the underlying EC2 node cost.
cpu_usageRatio of CPU cores in use to CPU cores allocated (value between 0 and 1).
memory_usageRatio of memory in use to memory allocated (value between 0 and 1).
cluster_nameName of the cluster hosting the nodes and pods.
namespace_nameKubernetes namespace—a logical separation of services and deployment nodes.
pod_nameKubernetes pod name, which may host one or more containers.
container_nameDocker container name.
node_nameEC2 node on which the pod is deployed.
deployment_nameName of the Kubernetes Deployment managing the pod.

Example query:

FROM KubernetesCost SELECT * SINCE 1 week ago

For accurate Kubernetes costs, multiply cpu_weightage + memory_weightage in your queries:

SELECT SUM(net_unblended_cost * (cpu_weightage + memory_weightage) + network_net_unblended_cost) FROM KubernetesCost SINCE '2026-09-01' UNTIL '2026-09-10'

The query multiplies net_unblended_cost by the sum of CPU and memory weightage for accurate cost allocations based on resource usage.

Query Console showing KubernetesCost event attributes

Identify the most expensive Kubernetes namespaces:

FROM KubernetesCost SELECT SUM(total_cost) FACET namespace_name SINCE 1 week ago LIMIT 10

Compare CPU cost to memory cost per cluster:

FROM KubernetesCost SELECT SUM(cpu_costs), SUM(memory_costs) FACET cluster_name SINCE 1 week ago

Find under-utilized containers where CPU usage is low:

FROM KubernetesCost SELECT average(cpu_usage) FACET container_name WHERE cpu_usage < 0.2 SINCE 3 days ago

CloudCostEstimate

CloudCostEstimate is a real-time event generated by Cloud Cost Intelligence. It provides estimated cloud costs at the resource level, including AWS instance details and metadata such as team ownership, environment, and service name. This event type supports only a subset of NRQL clauses.

Key attributes

The following attributes are most useful for building CloudCostEstimate queries:

AttributeDescription
costEstimated cost in the currency of your cloud bill for the resource over the usage period.
owning_teamValue of the owning_team tag applied to the resource, if present.
product_codeCloud provider service code (for example, EC2).
service_nameThe service the estimate is for.
instance_typeAWS EC2 instance type (for example, m6g.8xlarge). Applies to AWS resources only.
aws_regionAWS region where the resource is deployed (for example, us-east-2).
departmentValue of the department tag applied to the resource, if present.
environmentDeployment environment of the resource, sourced from the resource's environment tag.

Example query:

FROM CloudCostEstimate SELECT * SINCE 24 hours ago
Query Console showing CloudCostEstimate event attributes

Review estimated costs by owning team:

FROM CloudCostEstimate SELECT SUM(cost) FACET owning_team SINCE 24 hours ago

Supported NRQL clauses

The following clauses are supported for CloudCost, KubernetesCost, and CloudCostEstimate. CloudSpend and KubernetesSpend support the full NRQL language.

CategorySupported clauses
ClausesSELECT, WHERE, SINCE, UNTIL, LIMIT, TIMESERIES, TIMESERIES… FACET…
Aggregate functionsCOUNT, SUM, MIN, MAX, UNIQUES(), UNIQUECOUNT()
OperatorsLIKE, IN, NOT IN, AND, OR, <, <=, >, >=, !=
Time functionsDATEOF(), HOUROF()

Troubleshooting

Resolve common issues during Cloud Cost Intelligence setup

1Intelligent summary

2Cost overview

3Kubernetes cost insights

4Budgets

5Cost optimization recommendations

6Query your data with NRQL

You are here
Copyright © 2026 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.