Understanding of Newrelic agent configuration file newrelic.yml vs newrelic.config

The New Relic agent reads its configuration from the newrelic.yml or newrelic.config. New Relic APM agent configuration options allow you to control some aspects of how the agent behaves. Some of these config options are part of the basic install process.

Go agentnewrelic.Config
Java agentnewrelic.Config
DOT NET agentnewrelic.config
Node.js agentnewrelic.js
Node.js agentnewrelic.js
Python agentnewrelic.ini
Ruby agentnewrelic.yml

Newrelic Java Agent

The Java agent requires the license_key and app_name settings at startup. All the other settings are optional. The New Relic Java agent reads its configuration from the newrelic.yml file. By default the agent looks for this file in the directory that contains newrelic.jar.

You can override the config file’s location by setting the newrelic.config.file system property to a fully qualified file name.

System property

system property means, these property you can set in app runtime environment such jvm or dotnet.

Such as in tomcat catlina.bat
export JAVA_OPTS=”$JAVA_OPTS -javaagent:/var/lib/tomcat8/webapps/newrelic/newrelic.jar”
or catlina.sh
SET JAVA_OPTS=%JAVA_OPTS% -javaagent:/full/path/to/newrelic.jar
Where as -javaagent is system property. You can override the config file’s location by setting the newrelic.config.file system property to a fully qualified file name.
i.e java -Dnewrelic.config.file=/opt/tomcat/newrelic/newrelic.yml

The Newrelic configuration file such newrelic.yml file is split into stanzas corresponding to different environments:

  • Test
  • Development
  • Staging
  • Production (default)

New Relic applies settings in the common stanza to each of these environments. You can select other environments as the default by setting the newrelic.environment system property to the environment name.

General configuration settings in Java agent newrelic.yml Specification

license_key (REQUIRED)
app_name (REQUIRED)
agent_enabled
apdex_t (DEPRECATED)
appserver_port
audit_mode
ca_bundle_path
enable_auto_app_naming
enable_auto_transaction_naming
enable_custom_tracing
extensions.dir
high_security
insert_api_key
labels
max_stack_trace_lines
proxy_host
proxy_password
proxy_port
proxy_user
proxy_scheme
send_data_on_exit
send_data_on_exit_threshold
send_environment_info
send_jvm_props
ssl (DEPRECATED)
sync_startup
scala_futures_as_segments

Configuration settings precedence

Configuration settings precedence

To override any setting in the config file, use a system property override. In certain environments, environment variables can also be used to override both the config file and the system properties. The environment variables primarily exist to support Heroku.

With the Java agent,

  • server-side configuration overrides all other settings.
  • Environment variables override Java system properties.
  • Java properties override user configuration settings in your newrelic.yml file.
  • User settings in App custome override the newrelic.yml default settings.

Newrelic Configuration settings precedence Java Agent

Newrelic Configuration settings precedence Go agent

Newrelic Configuration settings precedence DOT NET Agent

Newrelic Configuration settings precedence Node.js agent

Newrelic Configuration settings precedence PHP agent

Newrelic Configuration settings precedence Python agent

Newrelic Configuration settings precedence Ruby agent

Reference

Rajesh Kumar
Follow me