Configure the infrastructure agent

The infrastructure agent can be configured in a variety of ways. The default method is to edit the configuration variables in the newrelic-infra.yml file.

A configuration file template is available in Infrastructure config file template. You can also override the config file by setting environment variables, or use config management tools, such as Ansible or Puppet.

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

Configuration methods and precedence

The default method to configure the infrastructure agent is the ​newrelic-infra.yml config file. You can override the config file by setting environment variables, which is ideal for containerized environments.

infrastructure config cascade (orders of precedence).png
Environment variables override the config file. The config file overrides the agent defaults.

Here are detailed descriptions of each configuration method:

Configuration file (newrelic-infra.yml) location and description

To configure the infrastructure agent, use the newrelic-infra.yml file. Its default location 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

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. Only use environment variables with containerized environments.

The options described in the infrastructure config file template include their corresponding environment variables, labeled as Env var. Environment variables are also listed in Infrastructure configuration settings.

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, and can be set through one of the following methods.

  • From inside the config file: add an entry to the infrastructure config file to allow the agent to get the environment variables you've set.

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

    NRIA_PASSTHROUGH_ENVIRONMENT="HTTPS_PROXY,HTTP_PROXY"

For a better understanding of configuration settings, see Infrastructure configuration settings, which contains a detailed explanation of each variable.

Configuration file structure

When editing newrelic-infra.yml, you must conform to the YAML format and adhere to the following rules:

  • Do not modify the casing of the configuration options: YAML keys are case sensitive.
  • Respect the indentation levels. 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).

A template of newrelic-infra.yml is available in the infrastructure agent repository. Use a validator to ensure the syntax is accurate before using the file with the infrastructure agent

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

Configuration management tools

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

For more help

If you need more help, check out these support and learning resources: