---
title: New Relic Ingest actions
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/newrelic/newrelic-ingest
---

This page provides a comprehensive reference for new relic ingest actions available in the workflow automation actions catalog. These actions enable you to send events and logs to new relic.

## Prerequisites

Before using New Relic actions in workflow automation, ensure you have:

-   A New Relic account with appropriate permissions.
-   A New Relic license key (if sending data to a different account).
-   The necessary permissions for the specific New Relic services you plan to use.

See [License Key](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys#license-key) for information on how to create and manage your New Relic Account License Key.

## Data ingest actions

**Send events**

Reports a custom event to New Relic.

### Inputs

| Input Field    | Optionality | Type   | Description                                                                                                                                                                                                                                                                                                                                                                 | Example                                                                                                                                       |
| -------------- | ----------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| **attributes** | Optional    | Map    | Common attributes which is part of all the events when provided. Merging for each event item when needed event item overrides common definition.                                                                                                                                                                                                                            | `"{\"page\": \"1\", \"limit\": \"10\"}"`                                                                                                      |
| **events**     | Required    | List   | The list of event data. Events requires the use of an eventType field that represents the custom event type. The maximum events allowed per request is 100.                                                                                                                                                                                                                 | `"[{\"eventType\":\"XYZ\",\"attributes\":{\"foo\":\"bar\"}}, {\"eventType\":\"ABC\",\"value\":\"1234\",\"attributes\":{\"color\":\"red\"}}]"` |
| **licenseKey** | Optional    | String | The **New Relic Account License Key** (required) specifies the target account for your events. If not provided, the system uses the default license key from the account executing the workflow. [Read more about our API keys](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys#license-key) to create and manage your **New Relic Account License Key**. | `"{{ .secrets.secretName }}"`, where `secretName` is the key under which the license key is stored.                                           |
| **selectors**  | Optional    | List   | The selectors to get only the specified parameters as output.                                                                                                                                                                                                                                                                                                               | `[{\"name\": \"success\", \"expression\": \".success\"}]`                                                                                     |

### Outputs

| Output Field     | Type    |
| ---------------- | ------- |
| **success**      | Boolean |
| **errorMessage** | string  |

### Example

| Workflow example                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ```yaml name: heartbeat_newrelicIngestSendEvents  workflowInputs:   cellName:     type: String  steps:   - name: runAction     type: action     action: newrelic.ingest.sendEvents     version: 1     inputs:       attributes:         colour: red         id: 1234       events:         - eventType: HeartBeat           test: "OK"           attributes:             foo: bar         - eventType: HeartBeat1234           test: "OK1234"           attributes:             foo: bar         - eventType: HeartBeat12345           test: "OK12345"           attributes:             foo: bar             colour: yellow         - eventType: HeartBeat12345678           test: "OK12345678"       selectors:         - name: success           expression: ".success" ``` **Expected output:** ```yaml   {     "success": true   } ``` **Retrieve events:** After successfully executing a workflow, you can retrieve the associated event by running a query under the account that executed the workflow: ```sql SELECT * FROM HeartBeat ``` |

**Send logs**

Send logs to New Relic

### Inputs

| Input Field    | Optionality | Type   | Description                                                                                                                                                                                                                                                                                                                                                                 | Example                                                                                                                                   |
| -------------- | ----------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **attributes** | Optional    | Map    | Common attributes are included in all logs when provided. These merge with each log item, with log-specific values overriding common attributes when conflicts occur.                                                                                                                                                                                                       | `"{\"page\": \"1\", \"limit\": \"10\"}"`                                                                                                  |
| **logs**       | Required    | List   | List of logs. Each **log** requires a `message` field. Maximum of 100 logs per request.                                                                                                                                                                                                                                                                                     | `"[{\"message\":\"XYZ\",\"attributes\":{\"foo\":\"bar\"}}, {\"message\":\"ABC\",\"value\":\"1234\",\"attributes\":{\"color\":\"red\"}}]"` |
| **licenseKey** | Optional    | String | The **New Relic Account License Key** (required) specifies the target account for your events. If not provided, the system uses the default license key from the account executing the workflow. [Read more about our API keys](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys#license-key) to create and manage your **New Relic Account License Key**. | `"{{ .secrets.secretName }}"`, where `secretName` is the key under which the license key is stored.                                       |
| **selectors**  | Optional    | List   | The selectors to get only the specified parameters as output.                                                                                                                                                                                                                                                                                                               |                                                                                                                                           |

### Outputs

| Output Field     | Type    |
| ---------------- | ------- |
| **success**      | Boolean |
| **errorMessage** | string  |

### Example

| Workflow example                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ```yaml name: heartbeat_newrelicIngestSendLogs  workflowInputs:   cellName:     type: String  steps:   - name: runAction     type: action     action: newrelic.ingest.sendLogs     version: 1     inputs:       attributes:         colour: red         id: 1234       logs:         - message: 'Heartbeat sendLogs Action Test Message'           attributes:             foo: bar         - message: 'HeartBeat1234'           attributes:             foo: bar         - message: 'HeartBeat12345'           attributes:             foo: bar             colour: yellow         - message: 'HeartBeat12345678'       selectors:         - name: success           expression: ".success" ``` **Expected output:** ```yaml   {     "success": true   } ``` **Retrieve logs:** After successfully executing a workflow, you can retrieve the associated log by running a query under the account that executed the workflow: ```sql SELECT * FROM Log ``` |

**Send metrics to New Relic**

### Inputs

| Input Field    | Optionality | Type   | Example                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| -------------- | ----------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **metrics**    | Required    | List   | `[ { "name": "service.errors.all", "type": "count", "value": 9, "attributes": { "service.response.statuscode": "400" } }, ` `{ "name": "service.errors.all", "type": "gauge", "value": 4, "attributes": { "service.response.statuscode": "500" } }, ` `{ "name": "service.response.duration", "type": "summary", "value": { "count": 5, "sum": 0.004382655, "min": 0.0005093, "max": 0.001708826 }, "attributes": { "service.response.statuscode": "200" } } ]`                                                                                                              |
| **attributes** | Optional    | Map    | `{ "timestamp": 1531414060739, "interval.ms": 10000, "attributes": { "app.name": "foo", "host.name": "dev.server.com" } }`                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| **licenseKey** | Optional    | String | The **New Relic Account License Key** (required) specifies the target account for your events. If not provided, the system uses the default license key from the account executing the workflow. [Read more about our API keys](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys#license-key) to create and manage your **New Relic Account License Key**. Do not input credentials in plain text. Please see example of secrets syntax below. Example: `"{{ .secrets.secretName }}"`, where `secretName` is the key under which the license key is stored. |
| **selectors**  | Optional    | List   | `[{"name": "error", "expression": ".errorMessage"}]`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

#### Required key-value pairs in the `metrics`

Each metric data point map in the `metrics` list uses the following key-value structure:

| Attribute       | Type                               | Optionality                                                                                                                                | Description                                                                                                                                                                                                                                                                                                                                                                                     |
| --------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **name**        | String                             | Required                                                                                                                                   | The name of the metric. The value must be less than 255 characters.                                                                                                                                                                                                                                                                                                                             |
| **value**       | Number or Map                      | Required                                                                                                                                   | The value varies depending on the [metric type](https://docs.newrelic.com/docs/data-apis/understand-data/metric-data/metric-data-type/). For `gauge` and `count` the value should be a single number. For `summary`, the value should be a map with key-value pairs specifying the count, sum, min, and max.                                                                                    |
| **timestamp**   | Long                               | Optional                                                                                                                                   | The metric's start time in [Unix time](https://currentmillis.com/). The default uses UTC time zone. This field also support seconds, microseconds, and nanoseconds. However, the data will be converted to milliseconds for storage and query. Metrics are dropped if they have a timestamp more than 48 hours in the past or more than 24 hours in the future from the time they are reported. |
| **interval.ms** | Positive long                      | Required for `count` and `summary` [metric types](https://docs.newrelic.com/docs/data-apis/understand-data/metric-data/metric-data-type/). | The length of the time window.                                                                                                                                                                                                                                                                                                                                                                  |
| **type**        |                                    | Recommended                                                                                                                                | Supports only `count`, `gauge`, `summary`, see [supported metric types](https://docs.newrelic.com/docs/data-apis/understand-data/metric-data/metric-data-type/) for more information. If you do not specify a type, then this will default to a `gauge`.                                                                                                                                        |
| **attributes**  | Strings, JSON numbers, or Booleans | Recommended                                                                                                                                | A map of key value pairs associated with this specific metric. Values can be strings, JSON numbers, or booleans. Keys are case-sensitive and must be less than 255 characters.                                                                                                                                                                                                                  |

> #### ⚠️ IMPORTANT
>
> The metrics API mandates a `timestamp`. Within the action, the `timestamp` is optional, defaulting to the current time if not supplied prior to metrics ingestion.

#### Share attributes across metrics with `common`

If you want to include a set of attributes on multiple metrics (and not add the same attributes for each metric), you can use the `common` block. This is an optional map that specifies information that applies to all associated metric data points. Values in the `common` section will be overridden if the same key exists on a metric data point.

The block can include:

| Attribute       | Type                               | Optionality                        | Description                                                                                                                                                                                                                                                                      |
| --------------- | ---------------------------------- | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **timestamp**   | Long                               |                                    | The metric's start time in [Unix time](https://currentmillis.com/). This defaults to the current time in the UTC time zone. This field also supports seconds, microseconds, and nanoseconds. However, the data will be converted to milliseconds for storage and later querying. |
| **interval.ms** | Positive long                      | Required for `count` and `summary` | The length of the time window.                                                                                                                                                                                                                                                   |
| **attributes**  | Strings, JSON numbers, or Booleans |                                    | A map of key-value pairs associated with this specific metric. Values can be strings, JSON numbers, or booleans.                                                                                                                                                                 |

### Outputs

| Output Field     | Type    | Example                                |
| ---------------- | ------- | -------------------------------------- |
| **requestId**    | String  | `13325ef9-0001-b193-510f-019ba20b0792` |
| **success**      | Boolean | `success: true | false`                |
| **errorMessage** | String  | `Failure reason as message.`           |

### Example

| Workflow example                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ```yaml   - name: sendMetrics     type: action     action: newrelic.ingest.sendMetrics     version: 1     inputs:       metrics:         - name: service.errors.all           type: count           value: 9           timestamp: 1531414060739           attributes:             service.response.statuscode: 400         - name: service.response.duration           type: guage           value: 4           timestamp: 1531414060733           attributes:             service.response.statuscode: 500 ``` |
