Configurationedit

To adapt the Elastic APM Java agent to your needs, you can configure it using one of the methods below, listed in descending order of precedence:

1) Central configuration

Configure the Agent in the Kibana APM app. dynamic config

2) Properties file

The elasticapm.properties file is located in the same folder as the agent jar, or provided through the config_file option. dynamic config

3) Java system properties

All configuration keys are prefixed with elastic.apm.
dynamic config

4) Environment variables

All configuration keys are in uppercase and prefixed with ELASTIC_APM_.

5) Runtime attach parameters

  1. --config parameter.
    See Automatic setup with apm-agent-attach-cli.jar.
  2. Arguments of ElasticApmAttacher.attach(...).
    See Programmatic API setup to self-attach.
  3. elasticapm.properties in classpath root with ElasticApmAttacher.attach().
    See Programmatic API setup to self-attach.

6) Default values

Defined for each configuration.

Dynamic configuration dynamic configedit

Configuration options marked with Dynamic true can be changed at runtime when set from supported sources:

  • Central configuration
  • elasticapm.properties file
  • Java system properties, but only when set from within the application

There are two distinct ways to use elasticapm.properties: as an external configuration file, and as a classpath resource.
Only the external file can be used for dynamic configuration.

Minimal configurationedit

In order to get started with Elastic APM, the most important configuration options are service_name, server_url and application_packages. Note that even these settings are optional. Click on their name to see how the default values are determined.

An example configuration looks like this:

System properties.

-Delastic.apm.service_name=my-cool-service
-Delastic.apm.application_packages=org.example,org.another.example
-Delastic.apm.server_url=http://127.0.0.1:8200

elasticapm.properties.

service_name=my-cool-service
application_packages=org.example,org.another.example
server_url=http://127.0.0.1:8200

Environment variables.

ELASTIC_APM_SERVICE_NAME=my-cool-service
ELASTIC_APM_APPLICATION_PACKAGES=org.example,org.another.example
ELASTIC_APM_SERVER_URL=http://127.0.0.1:8200

Option referenceedit

This is a list of all configuration options grouped by their category. Click on a key to get more information.