Elastic APM Agent Configuration Options are not working

4.5k Views Asked by At

Elasticsearch,kibana and apm-server are installed in a ec2 server I have installed automatic java agent attach to another server to track jenkins app

Agent is getting attached to the process but dynamic configuration options are not working

Apmagent directory: (command ls)

apm-agent-attach-standalone.jar elasticapm.properties

elasticapm.properties file

service_name="jenkins-dev"
server_url="http://x.x.x.x:8200"
recording=true
enabled=true
log_level="DEBUG"
log_file=_AGENT_HOME_/logs/elastic-apm.log

Attach Command:

sudo java -jar apm-agent-attach-standalone.jar --include '.jenkins.'

->This doesn't pick configuration file but attached the agent

so i used below command to update

sudo java -jar apm-agent-attach-standalone.jar --include '.*jenkins.*' --config recording=false,enabled=false

sudo java -jar apm-agent-attach-standalone.jar --include '.*jenkins.*' --config 
config_file=elasticapm.properties log_file=/etc/apmagents/apm.log

Log:

2021-04-12 10:47:20,338 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Error trying to connect to APM Server. Some details about SSL configurations corresponding the current connection are logged at INFO level.
2021-04-12 10:47:20,339 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type JSON_WRITER with this error: Connection refused (Connection refused)
2021-04-12 10:47:20,339 [elastic-apm-server-reporter] INFO  co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)
2021-04-12 10:47:24,345 [elastic-apm-remote-config-poller] ERROR co.elastic.apm.agent.configuration.ApmServerConfigurationSource - Connection refused (Connection refused)

Query:

1.Which is the right way to use the configuration options in command line?

2.Do we need to create a log file or it will create if log_file is used..now its polluting the application log

1

There are 1 best solutions below

0
On BEST ANSWER

Try to specify the config_file using the following notation:

-Delastic.apm.config_file=elasticapm.properties

The attacher can create the log file depending on the settings configured during startup. See the [1] current code for a better understanding.

[1] https://github.com/elastic/apm-agent-java/blob/0465d479430172c3e745afd2ef5b62a3da6b60aa/apm-agent-attach-cli/src/main/java/co/elastic/apm/attach/AgentAttacher.java#L79