Relocate Config and Log Directories

Regardless of the APM Java Agent provisioning scenario selected, either single server or shared location, by default both config and log directories from the agent installation are read from and write to the same agent installation where binaries are read.

However, in some deployment scenarios, config and log directories are better to be separated from the agent installation therefore you may want to relocate agent config directory and/or log directory from the provisioned agent.

Both config and log directory location can be overwritten with Java system properties, or environment variables:

Setup agent with custom config and/or log directory by using system properties

Depending on the appserver, the syntax to set java system properties varies.

In general, if you need to change startup script to add system properties to Java command, you need to prefix the property argument with dash-capital-d ( -D ) having key and value separated by equal sign ( = ).
  1. Provision agent to appserver or shared location.
  2. Copy config directory (including all sub-directoies with version numbers) from provisioned agent destination to a new location.
  3. Add system property com.oracle.apm.agent.config.dir and/or com.oracle.apm.agent.log.dir with new locations to JVM startup. Consult your appserver document on what is the appropriate way to add java system properties. For example: java … -javaagent:<agent_path>/oracle-apm-agent/bootstrap/ApmAgent.jar -Dcom.oracle.apm.agent.config.dir=<config_path> -Dcom.oracle.apm.agent.log.dir=<log_path>...
  4. Save script or setting, and restart appserver for agent to pick up new config and/or log directories.

Setup agent with custom config and/or log directory by using environment variables

Set environment variables with appropriate custom config and/or log directory.

Scenario 1:

I have to create a docker image having APM agent within the image, but I want to have config and logs reside on NAS.

There are 3 ways to do this:
  • Change appserver startup script to include both config and log paths pointing to config and log on NAS
  • Set environment variables of config dir and log paths in docker image.
  • Pass environment variables of config dir and log paths on docker startup.

Scenario 2:

I want to provision agent to each appserver host to make sure all binaries are always available, but I want to load config from shared drive.

You can configure APM agent to only use custom config directory by setting just com.oracle.apm.agent.config.dir system property (or com_oracle_apm_agent_config_dir environment variables). This leaves agent log files together with agent binaries.