---
title: Node.js agent error collector settings
source: https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration-error-collector-settings
---

This page covers the Node.js agent settings for error collection, including which HTTP status codes and error classes to ignore or mark as expected, and how many error events to sample per minute.

> #### 💡 TIP
>
> Back to the full settings index: [Node.js agent configuration](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration)

## Error collector variables [#error_config]

You can [manage how error are handled](https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-data/manage-errors-apm-collect-ignore-mark-expected) in New Relic. This section defines the Node.js agent variables in the order they typically appear in the `error_collector: {` section of your app's `newrelic.js` configuration file.

**enabled**

| Type                              | Boolean                             |
| --------------------------------- | ----------------------------------- |
| Default                           | `true`                              |
| [Environ variable](#environment)  | `NEW_RELIC_ERROR_COLLECTOR_ENABLED` |
| [Server-side label](#server-side) | `Enable error collection?`          |

When enabled, the agent collects [error traces](https://docs.newrelic.com/docs/apm/applications-menu/events/viewing-apm-errors-error-traces) from your app.

**ignore_status_codes**

| Type                              | Array of Integers                              |
| --------------------------------- | ---------------------------------------------- |
| Default                           | `[404]`                                        |
| [Environ variable](#environment)  | `NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERROR_CODES` |
| [Server-side label](#server-side) | `Ignore these status codes`                    |

Comma-delimited list of HTTP status codes for the error collector to ignore.

> #### ⚠️ CAUTION
>
> Errors recorded using [`newrelic.noticeError()`](https://newrelic.github.io/node-newrelic/API.html#noticeError) do not obey this configuration value.

**ignore_classes**

| Type                             | Array\|Object                             |
| -------------------------------- | ----------------------------------------- |
| Default                          | `[]`                                      |
| [Environ variable](#environment) | `NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERRORS` |

Comma-delimited list of javascript error types/classes for the error collector to ignore.

The following configuration

````js
error_collector: {
  /* ... */
  ignore_classes: ["ReferenceError"]
}
```

Would ignore all reference errors.

<Callout variant="caution">
  Errors recorded using [`newrelic.noticeError()`](https://newrelic.github.io/node-newrelic/API.html#noticeError) do not obey this configuration value.
</Callout>

````

**ignore_messages**

| Type                             | Object                                      |
| -------------------------------- | ------------------------------------------- |
| Default                          | `{}`                                        |
| [Environ variable](#environment) | `NEW_RELIC_ERROR_COLLECTOR_IGNORE_MESSAGES` |

A JavaScript object describing a list of classes tied to error messages for the collector to ignore. The following configuration would ignore all errors of the type `Error` with the exact (case-sensitive) message strings of `Undefined` and `Out of time`:

````js
error_collector: {
  /* ... */
  ignore_messages: {"Error":["Undefined", "Out of time"]}
}
```

Would ignore all errors of type `Error`, with the exact (case-sensitive) message strings of `Undefined` and `Out of time`.

<Callout variant="caution">
  Errors recorded using [`newrelic.noticeError()`](https://newrelic.github.io/node-newrelic/API.html#noticeError) do not obey this configuration value.
</Callout>

````

**expected_status_codes**

| Type                             | Array of integers                                |
| -------------------------------- | ------------------------------------------------ |
| Default                          | `[]`                                             |
| [Environ variable](#environment) | `NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERROR_CODES` |

Comma-delimited list of HTTP status codes for the error collector to mark as expected.

> #### ⚠️ CAUTION
>
> Errors recorded using [`newrelic.noticeError()`](https://newrelic.github.io/node-newrelic/API.html#noticeError) do not obey this configuration value.

**expected_classes**

| Type                             | Array                                       |
| -------------------------------- | ------------------------------------------- |
| Default                          | `[]`                                        |
| [Environ variable](#environment) | `NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERRORS` |

The following configuration

````js
error_collector: {
  /* ... */
  expected_classes: ["ReferenceError"]
}
```

Would mark all reference errors as expected.

<Callout variant="caution">
  Errors recorded using [`newrelic.noticeError()`](https://newrelic.github.io/node-newrelic/API.html#noticeError) do not obey this configuration value.
</Callout>

````

**expected_messages**

| Type                             | Object                                        |
| -------------------------------- | --------------------------------------------- |
| Default                          | `{}`                                          |
| [Environ variable](#environment) | `NEW_RELIC_ERROR_COLLECTOR_EXPECTED_MESSAGES` |

A javascript object describing a list of javascript classes tied to javascript error messages for the collector to ignore. The following configuration.

````js
error_collector: {
  /* ... */
  expected_messages: {"Error":["Undefined", "Out of time"]}
}
```

Would mark all errors of type `Error`, with the exact (case-sensitive) message strings of `Undefined` and `Out of time`.

<Callout variant="caution">
  Errors recorded using [`newrelic.noticeError()`](https://newrelic.github.io/node-newrelic/API.html#noticeError) do not obey this configuration value.
</Callout>

````

**attributes.enabled**

| Type                             | Boolean                                        |
| -------------------------------- | ---------------------------------------------- |
| Default                          | `true`                                         |
| [Environ variable](#environment) | `NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_ENABLED` |

If `true`, the agent captures attributes from error collection.

> #### ⚠️ CAUTION
>
> Any header-related include/exclude rules must be in camelCase form to be filtered.

**attributes.exclude**

| Type                             | Array                                          |
| -------------------------------- | ---------------------------------------------- |
| Default                          | `[]`                                           |
| [Environ variable](#environment) | `NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_EXCLUDE` |

Prefix of attributes to exclude from error collection. Allows `*` as wildcard at end.

**attributes.include**

| Type                             | Array                                          |
| -------------------------------- | ---------------------------------------------- |
| Default                          | `[]`                                           |
| [Environ variable](#environment) | `NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_INCLUDE` |

Prefix of attributes to include in error collection. Allows `*` as wildcard at end.

**max_event_samples_stored**

| Type                             | Integer                                              |
| -------------------------------- | ---------------------------------------------------- |
| Default                          | `100`                                                |
| [Environ variable](#environment) | `NEW_RELIC_ERROR_COLLECTOR_MAX_EVENT_SAMPLES_STORED` |

Defines the maximum number of events the agent collects per minute. If there are more than this number, the agent collects a statistical sampling.
