Can APM agent configuration be stored in application properties

I am setting up APM and am using a Java APM agent for a Springboot app. Based on this documentation, the configuration is stored in src/main/resources/ .

Can these configuration be stored in instead?

Also, is the APM token a compulsary field in the properties file? I saw several examples using the token field but minimal configuration at this document has only service name, url and application packages.

Kibana version: 8.2.3

Elasticsearch version: 8.2.3

APM Server version: 8.2.3

APM Agent language and version: Java, 1.34.0

Browser version: Chrome 105.0.5195

Hi @Ong !

Yes, the agent can use application properties that are stored in the application classpath, but that requires to use runtime attach setup : Programmatic API setup to self-attach | APM Java Agent Reference [1.x] | Elastic

If you are using another setup option like the classical -javaagent JVM option, it means that you have to first remove this JVM option before using it. Another major difference is that with it the agent becomes part of your application dependencies, which means updating the agent means updating and re-deploying the application, which could also be a desirable feature depending how you deploy your application.

The APM token is not mandatory at the agent level, but might be required to authenticate when communicating with apm-server, so most of the time you will have to configure it or use API keys for authentication.

1 Like

Another option would be to set the config_file option to via system properties.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.