Configure the Infrastructure agent

New Relic Infrastructure includes a configuration file (newrelic-infra.yml) to fine-tune agent behavior using an extensive set of configuration variables. Only the license_key setting is required for the agent to work correctly.

The default method to configure the Infrastructure agent is with the config file (newrelic-infra.yml). However, you can also override the config file by setting environment variables, which is ideal for containerized environments.

To configure Infrastructure integrations, see the specific integration's documentation.

For more information, check out New Relic University’s tutorial Creating and viewing custom attributes in Infrastructure Or, go directly to the full online course Getting started with Infrastructure.

Configuration management tools

To dynamically create your configuration file and manage the Infrastructure agent with configuration management tools, see the Infrastructure documentation for:

Configuration methods and precedence

The default method to configure the Infrastructure agent is with the config file (newrelic-infra.yml). However, you can also override the config file by setting environment variables, which is ideal for containerized environments.

Here are detailed descriptions of each configuration method:

infrastructure config cascade (orders of precedence).png
For the Infrastructure agent, environment variables override the config file. The config file overrides the agent defaults.
Configuration file (newrelic-infra.yml) location and description

To configure the Infrastructure agent, use the YAML-formatted file named newrelic-infra.yml. The default location of the file is:

  • Linux: /etc/newrelic-infra.yml
  • Windows: C:\Program Files\New Relic\newrelic-infra\newrelic-infra.yml

For a sample config file, see our Infrastructure config file template.

Environment variable syntax and description

Only use environment variables with containerized environments. To set an environment variable, use the variable name from the config file in all caps and prefix with NRIA_; for example, NRIA_LICENSE_KEY. The config options in this document include their corresponding environment variables, labeled as Environ variable.

Using environment variable passthroughs with on-host integrations

You can use environment variables to control config settings for on-host integrations, which can then be passed through to the Infrastructure agent. Variables that can be used with each on-host integration are listed in the documentation for each integration, then you can pass through by using one of the following two options:

  • From inside the config file: add an entry to the Infrastructure agent config file to allow the agent to pick up on the environment variables you've set. Example:

    passthrough_environment:
      - HTTPS_PROXY
      - HTTP_PROXY
  • From the command line: use another environment variable to pass through these settings. Example:

    NRIA_PASSTHROUGH_ENVIRONMENT="HTTPS_PROXY,HTTP_PROXY"

To understand the configuration options, see our Infrastructure configuration settings doc for a detailed explanation of each variable.

Configuration file structure

If you edit newrelic-infra.yml, you must conform to the YAML format. Use a YAML validator to ensure the syntax is accurate before using the file with New Relic's Infrastructure agent, and adhere to the following rules:

  • YAML files are case sensitive.
  • All indentations are in similar increments, typically of two space characters. Data in the same stanza of the file must use the same level of indentation. Indent any sub-stanzas by an additional two spaces (see examples in Custom attributes and Network interface filters).
  • You must restart your agent (newrelic-infra process) for changes to take effect.

Always restart the agent or your web server after changing settings.

For more help

Recommendations for learning more: