---
id: new-relic
title: Webhook Connection for New Relic
sidebar_label: New Relic
description: Send data from alerts to your New Relic account.
slug: /help/docs/alerts/webhook-connections/new-relic/
canonical: https://www.sumologic.com/help/docs/alerts/webhook-connections/new-relic/
---
import useBaseUrl from '@docusaurus/useBaseUrl';
New Relic webhook connections allow you to send alert results to New Relic as a custom event (Insight). You can learn more about the New Relic Insights custom events in their [API Help](https://docs.newrelic.com/docs/insights/explore-data/custom-events/insert-custom-events-insights-api).
[Webhook connections](set-up-webhook-connections.md) rely on HTTP endpoints that tell Sumo Logic where to send data. You can set up any number of connections.
Once you set up the webhook connection, you'll have the option to use it in a [Scheduled Search](schedule-searches-webhook-connections.md) or [Monitor](/docs/alerts/monitors).
## Set up a webhook connection for New Relic
You need the **Manage connections** [role capability](/docs/manage/users-roles/roles/role-capabilities) to create webhook connections.
1. [**New UI**](/docs/get-started/sumo-logic-ui). In the main Sumo Logic menu select **Monitoring > Connections**. You can also click the **Go To...** menu at the top of the screen and select **Connections**.
[**Classic UI**](/docs/get-started/sumo-logic-ui-classic). In the main Sumo Logic menu, select **Manage Data > Monitoring > Connections**.
1. On the **Connections** page, click **+ Add**.
1. For **Connection Type**, select **New Relic** from the dropdown.
1. In the **Connection Settings** dialog, enter:
* **Name**. Enter a name for the connection.
* (Optional) **Description**. Enter a description for the connection.
* **URL**. Enter the **URL** for the endpoint. See [Create an API key for New Relic Webhook](#create-an-api-keyfor-new-relic-webhook).
```
https://insights-collector.newrelic.com/v1/accounts/ACCOUNT_ID/events
```
* **Insert Key**. Enter your API Key generated from New Relic Insights. See [Create an API key for New Relic Webhook](#create-an-api-keyfor-new-relic-webhook).
* (Optional) **Custom Headers**. Enter up to five comma separated key-value pairs.
1. Customize your **Payload** to include any information you want to send from your scheduled search to New Relic. See [Send Events to New Relic using a Webhook](#send-events-to-new-relic-insights-using-a-webhook). For details on variables that can be used as parameters within your JSON object, see [webhook payload variables](set-up-webhook-connections.md).
1. Click **Test Alert** to test the connection. If successful, you'll see a `200 OK` response message.
1. Click **Save**.
## Create an API key for New Relic webhook
For the **Endpoint** and **Insert Key** fields of the webhook, you need to generate an API Key through the New Relic Insights UI:
1. In your New Relic Insights account, under **Manage Data**, click **API Keys**.
1. Click the **Add** button next to Insert Key.
1. Use the **Endpoint** and **Key** values for your webhook fields.
1. Enter an optional **Description** and click Save Your Notes to register the API Key.
## Send Events to New Relic Insights using a Webhook
Select the webhook connection in a [Scheduled Search](schedule-searches-webhook-connections.md) or [Monitor](/docs/alerts/monitors) to send events to New Relic Insights and use the following payload.
```json
{
"eventType": "{{Name}}",
"description": "{{Description}}",
"client": "Sumo Logic",
"search_url": "{{QueryUrl}}",
"num_records": "{{NumQueryResults}}",
"search_results": "{{ResultsJson}}"
}
```
Your payload must include "eventType" and "search_results" as
parameters.
* **eventType** can be a combination of alphanumeric characters, underscores `_`, and colons `:`. Special characters are not allowed.
* **search_results** must include `ResultsJson` as a variable.
A maximum of 200 aggregate results or 10 raw messages for this field can be sent via webhook. For more information, see [About Webhook Connections](set-up-webhook-connections.md).
By default, a "timestamp" field will be applied in New Relic Insights when the event is received. To override this, you must specify "timestamp" as a field in your Sumo Logic query (as an unformatted Unix timestamp, in seconds or milliseconds relative to the Unix epoch). For example, if you would like your timeslice to be represented in New Relic as the timestamp, you may add the following to your query:
```sumo
| timeslice 1m
| format ("%s",_timeslice) as timestamp
| count by timestamp
```