Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
212 changes: 212 additions & 0 deletions src/content/docs/data-reporting/scheduled-queries.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
---
title: Schedule NRQL queries
tags:
- Data reporting
- Scheduled queries
- NRQL automation
- Email delivery
- Query scheduling
- Workflow automation
metaDescription: "Automate your NRQL queries by scheduling them to run on a recurring basis and receive results via email."
freshnessValidatedDate: never
---

As a New Relic user, you may need to run the same NRQL queries repeatedly to monitor system performance, track trends, or generate regular reports. Manually executing these queries on a daily, weekly, or monthly basis is time-consuming and prone to oversight, especially when you need to share results with team members or stakeholders who aren't actively using New Relic.

Scheduled NRQL queries solve this problem by automating your query execution. You can schedule any NRQL query to run automatically at specified intervals and have the results delivered directly to email recipients, so you'll receive timely insights without manual effort.

<Callout title="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](/docs/licenses/license-information/referenced-policies/new-relic-pre-release-policy).
</Callout>

## What you can do

With scheduled NRQL queries, you can:

- **Automate repetitive queries**: Transform manual, repetitive NRQL queries into automated workflows that run on your schedule
- **Schedule flexible intervals**: Set queries to run using cron expressions for precise timing control
- **Deliver results via email**: Send query results as CSV or JSON attachments to specified email recipients
- **Query any data type**: While the initial entry point is through the Logs UI, you can schedule queries for any New Relic data (logs, metrics, events, transactions)
- **Manage centrally**: View, edit, delete, and duplicate all your scheduled queries from a central administration interface

## Pricing

Scheduled NRQL queries is an Advanced Compute Product feature offered as an
[add-on](/docs/accounts/accounts-billing/new-relic-one-pricing-billing/add-on-billing) or as a part of the Compute pricing model. Advanced
[CCUs](/docs/licenses/license-information/product-definitions/new-relic-one-pricing-definitions/#compute-capacity-unit) are consumed when queries are executed on their scheduled intervals.

## Prerequisites

To use scheduled NRQL queries, you need:

- A New Relic account with Pro or Enterprise pricing tier
- [Workflow automation capabilities](/docs/alerts-applied-intelligence/applied-intelligence/incident-workflows/incident-workflows/#permissions) permissions
- Access to the data you want to query (account-level access and any applicable data partition permissions)

## Access scheduled queries

To access scheduled queries:

1. Go to **[one.newrelic.com](https://one.newrelic.com) > Administration > All capabilities**.
2. Select **Scheduled searches**.

When you first visit this page, you'll see an empty state with the option to **Schedule a search**.

## Create a scheduled query

You can create scheduled queries from two entry points:

<Tabs>
<TabsBar>
<TabsBarItem id="from-logs">From Logs UI</TabsBarItem>
<TabsBarItem id="from-admin">From Administration</TabsBarItem>
</TabsBar>
<TabsPages>
<TabsPageItem id="from-logs">

### From the Logs UI

1. Go to **[one.newrelic.com](https://one.newrelic.com) > Logs**.
2. Create or refine your NRQL query in the logs interface.
3. Click the <Icon name="fe-more-horizontal"/> menu and select **Schedule search**, or click the clock icon.
4. The query from your current log view will be automatically pre-populated.
5. Continue with the configuration steps below.

</TabsPageItem>
<TabsPageItem id="from-admin">

### From Administration

1. Go to **[one.newrelic.com](https://one.newrelic.com) > Administration > All capabilities**.
2. Select **Scheduled searches**.
3. Click **Schedule a search**.
4. Enter your NRQL query manually.
5. Continue with the configuration steps below.

</TabsPageItem>
</TabsPages>
</Tabs>

## Configure your scheduled query

<Steps>
<Step>
### Define your query

1. **Name your search**: Enter a descriptive name for your scheduled query.
2. **Edit your query**: Review and modify the NRQL query as needed. You can query any New Relic data type, not just logs.
3. **Test your query**: Click **Run query** to preview the results and ensure your query works correctly.

The query builder includes the same autocomplete functionality available in other New Relic query interfaces.
</Step>

<Step>
### Configure notifications

1. **Choose destination**: Select either an existing email destination from your alerts configuration or add a new destination.
2. **Add email addresses**: If creating a new destination, enter the email addresses that should receive the results.
3. **Customize email content**:
- **Subject**: Customize the email subject line (defaults to your search name and date)
- **Body**: Add custom text to the email body, including variables like `{{Search_name}}`
4. **Select output format**: Choose what to include in the email:
- **CSV attachment**: Query results as a downloadable CSV file
- **JSON attachment**: Query results in JSON format
- **Search link**: A permalink back to the exact query in New Relic
</Step>

<Step>
### Set your schedule

Configure when your query should run:

1. **Cron expression**: Enter a cron expression to define your schedule timing.
2. **Time zone**: Specify the time zone for your scheduled query.
3. **Threshold options**: Choose when to send notifications:
- **Send every time**: Deliver results every time the query runs
- **Send only when results exist**: Only send emails when the query returns data (result count > 0)

The interface will display your cron expression in plain English to help you validate the timing (for example, "0 0 * * 2" displays as "Every Tuesday at 12am").

<Callout variant="tip">
Common cron expression examples:
- `0 9 * * 1-5`: Every weekday at 9 AM
- `0 0 * * 0`: Every Sunday at midnight
- `0 */6 * * *`: Every 6 hours
- `0 0 1 * *`: First day of every month at midnight
</Callout>
</Step>

<Step>
### Review and create

1. Review all your configuration settings.
2. Click **Create scheduled search**.
3. You'll see a confirmation message that your scheduled search has been created.
</Step>
</Steps>

## Manage scheduled queries

### View your scheduled queries

Go to **[one.newrelic.com](https://one.newrelic.com) > Administration > All capabilities > Scheduled searches** to see all your scheduled queries with details including:

- Name and description
- Destination type (email)
- Schedule frequency
- Last run time
- Status (active, paused, etc.)

### Edit a scheduled query

<Steps>
<Step>
From the scheduled searches list, click the <Icon name="fe-more-horizontal"/> menu next to the query you want to modify.
</Step>
<Step>
Select **Edit** to modify any aspect of your scheduled query including the NRQL query, schedule, destinations, or notification settings.
</Step>
<Step>
Save your changes when complete.
</Step>
</Steps>

### Other management options

From the scheduled searches list, you can:

- **Duplicate**: Create a copy of an existing scheduled query as a starting point for a new one
- **Pause/Resume**: Temporarily disable a scheduled query without deleting the configuration
- **Delete**: Permanently remove a scheduled query
- **Manual trigger**: Run a scheduled query immediately outside of its regular schedule

## Related topics

<DocTiles>
<DocTile
title="Logs UI"
path="/docs/logs/ui-data/use-logs-ui"
>
Learn how to use the Logs UI, where you can access the Schedule search option.
</DocTile>
<DocTile
title="NRQL reference"
path="/docs/nrql/get-started/introduction-nrql-new-relics-query-language"
>
Learn more about NRQL, New Relic's query language used in scheduled queries.
</DocTile>
<DocTile
title="Workflow automation"
path="/docs/alerts-applied-intelligence/applied-intelligence/incident-workflows/incident-workflows"
>
Understand the underlying workflow automation capabilities that power scheduled queries.
</DocTile>
<DocTile
title="Email alert destinations"
path="/docs/alerts-applied-intelligence/notifications/destinations"
>
Learn about configuring email destinations used for scheduled query results.
</DocTile>
</DocTiles>
5 changes: 5 additions & 0 deletions src/nav/data-reporting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: Data reporting
path: /docs/data-reporting
pages:
- title: Schedule NRQL queries
path: /docs/data-reporting/scheduled-queries
2 changes: 2 additions & 0 deletions src/nav/logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ pages:
pages:
- title: Logs UI
path: /docs/logs/ui-data/use-logs-ui
- title: Schedule NRQL queries
path: /docs/data-reporting/scheduled-queries
- title: Logs release notes
path: /docs/release-notes/logs-release-notes
- title: Log patterns
Expand Down
2 changes: 2 additions & 0 deletions src/nav/root.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ pages:
- title: Website performance monitoring
path: website-performance-monitoring
- title: Data insights
- title: Data reporting
path: data-reporting
- title: Agentic AI
path: agentic-ai
- title: Alerts
Expand Down
Loading