Automatic Agent Configuration Options are not working

Kibana version:
7.12

Elasticsearch version:
7.12

APM Server version:
7.12

APM Agent language and version:
1.21.0

Browser version:
Chrome 86

Original install method (e.g. download page, yum, deb, from source, etc.) and version:
From Source

Fresh install or upgraded from other version?
Fresh Install

Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.
No

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
I need to attach the agent to jenkins,setup i follow is automatic setup with java agent

Steps to reproduce:
1.In apmagents directory -> apm-agent-attach-standalone.jar and elasticapm.properties
2.
java -jar apm-agent-attach-standalone.jar --include '.jenkins.'

 java -jar apm-agent-attach-standalone.jar --include '.*jenkins.*'  -- config config_file=elasticapm.properties

java -jar apm-agent-attach-standalone.jar --include '.*jenkins.*' --config enabled=false recording=false log_level=DEBUG
  1. Agent is getting attached to the app but configuration options are not working

Errors in browser console (if relevant):
No error

Provide logs and/or server output (if relevant):

Response:

2021-04-12 10:16:10.270 INFO Attaching the Elastic APM agent to 1201 /usr/share/jenkins/jenkins.war -Djava.awt.headless=true with arguments {recording=false,enabled=false}
2021-04-12 10:16:10.718 INFO Done

Log file:

2021-04-12 10:27:11,244 [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:27:11,244 [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:27:11,245 [elastic-apm-server-reporter] INFO  co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)
2021-04-12 10:27:24,341 [elastic-apm-remote-config-poller] ERROR co.elastic.apm.agent.configuration.ApmServerConfigurationSource - Connection refused (Connection refused)

Issue:

Dynamic Configuration options are not working

Need:
Right Syntax for using
1.elasticapm.properties
2.Separate log file for agent
3.Enable/Disable and Recording

Also provide more details in documentation to use this

Hi @Kevin_Christopher ,

The runtime attach is a beta feature, and there will be some changes to expect in the next release (which will also improve logging and usability). I would thus recommend to do the following:

  • use the "standard" setup using the -javaagent JVM argument
  • write your configuration into an external properties file elasticapm.properties and make the agent use it through the config_file
  • then once everything works, switch to using runtime attach

The following message in the logs seems to indicate that the values for recording and enabled are properly set.

/usr/share/jenkins/jenkins.war -Djava.awt.headless=true with arguments {recording=false,enabled=false}

So, if I understand correctly the issue is that the log_level seems to be ignored, is that right ?

Also, I wonder what would be the use-case for setting enabled=false when using runtime-attach, as this properly can't be changed after agent startup, so you won't be able to enable the agent afterwards.

Hi @Sylvain_Juge

Yes I have used elasticapm.properties file via config_file and works..
Options like log_level and recording works via kibana ui config for apm service..

In some case if i want to remove the agent and after sometime i want to again attach it.

so you won't be able to enable the agent afterwards

If I give the command ,it will not attach to the application?

When you set enabled=false this completely disables the agent, it won't even try to reach Kibana to get configuration, thus you can't re-enable it afterwards.

If what you need is being able to start the agent without capturing any data, but still being able to enable it later on, for example through local properties configuration modification or with configuration in Kibana, then you only need to start it with recording=false at startup.

Running the above CLI command when the agent is already attached but disabled won't allow to make it start.

@Sylvain_Juge

Thanks for the explanation..Understood

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