---
title: Node.js agent logs in context settings
source: https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/nodejs-agent-configuration-logs-in-context-settings
---

This page covers the Node.js agent settings for application logging, including log forwarding to New Relic, local log decoration, logging metrics, and label forwarding.

> #### 💡 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)

## Application logging [#app-logging]

The application logging configuration settings require [Node.JS agent version 8.11.0 or higher](https://docs.newrelic.com/docs/apm/agents/nodejs-agent/installation-configuration/update-nodejs-agent/).

For tips on configuring logs for the Node.js agent, see [Configure Node.js logs in context](https://docs.newrelic.com/docs/logs/logs-context/configure-logs-context-nodejs).

**application_logging.enabled**

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

Enables automatically generating [logs in context](https://docs.newrelic.com/docs/logs/logs-context/configure-logs-context-nodejs/).

For example, to disable this feature in the config file, you would use:

````js
application_logging: {
  enabled: false
}
```

````

**application_logging.metrics.enabled**

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

Toggles whether the agent gathers Logging Metrics used in the Logs chart on the APM Summary page.

**application_logging.forwarding.enabled**

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

Toggles whether the agent gathers log records for sending to New Relic.

**application_logging.forwarding.max_samples_stored**

| Type                             | Number                                                        |
| -------------------------------- | ------------------------------------------------------------- |
| Default                          | `10000`                                                       |
| [Environ variable](#environment) | `NEW_RELIC_APPLICATION_LOGGING_FORWARDING_MAX_SAMPLES_STORED` |

Number of log records to send per minute to New Relic. Controls the overall memory consumption when using log forwarding.

Set this to a lower value to reduce the amount of log lines sent (may cause log sampling). Set this to a higher value to send more log lines.

Each log receives the same priority as its associated transaction. Logs that occur outside of a transaction will receive a random priority. Some logs may not be included because they are limited by `max_samples_stored`. For example, if logging `max_samples_stored` is set to 10,000 and transaction 1 has 10,000 log entries, only log entries for transaction 1 will be recorded. If transaction 1 has less than 10,000 logs you receive all logs for transaction 1. If there is still space, you receive all the logs for transaction 2, and so on.

If after all the logs for sampled transactions are recorded, and they haven't reached the limit in `max_samples_stored`, then log messages for transactions that were not in our sampling are sent. If there are any left, log messages outside of transactions are recorded.

**application_logging.forwarding.labels.enabled**

| Type                             | Boolean                                                   |
| -------------------------------- | --------------------------------------------------------- |
| Default                          | false                                                     |
| [Environ variable](#environment) | `NEW_RELIC_APPLICATION_LOGGING_FORWARDING_LABELS_ENABLED` |

Toggles whether the agent will add labels to log records for sending to New Relic.

**application_logging.forwarding.labels.exclude**

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

A case-insensitive list of label names to exclude when you enable including labels in logs. This attribute does not support wildcards or regex.

**application_logging.local_decorating.enabled**

| Type                             | Boolean                                                  |
| -------------------------------- | -------------------------------------------------------- |
| Default                          | `false`                                                  |
| [Environ variable](#environment) | `NEW_RELIC_APPLICATION_LOGGING_LOCAL_DECORATING_ENABLED` |

Toggles whether the agent performs Local Log Decoration on standard log output.
