# Automatic Agent Configuration Options are not working

**URL:** <https://discuss.elastic.co/t/automatic-agent-configuration-options-are-not-working/269862>\
**Category:** APM\
**Tags:** java\
**Created:** [April 12, 2021, 10:36am UTC](https://discuss.elastic.co/t/automatic-agent-configuration-options-are-not-working/269862 "2021-04-12T10:36:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_Christopher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevin_christopher/32/86261_2.png) [@Kevin\_Christopher](https://discuss.elastic.co/u/Kevin_Christopher)\
**Post date:** [April 12, 2021, 10:36am UTC](https://discuss.elastic.co/t/automatic-agent-configuration-options-are-not-working/269862/1 "2021-04-12T10:36:23Z")

</div>

**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:**

```auto
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

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [April 13, 2021, 12:14pm UTC](https://discuss.elastic.co/t/automatic-agent-configuration-options-are-not-working/269862/2 "2021-04-13T12:14:22Z")

</div>

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](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-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.

```auto
/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.

---

<div class="post-metadata">

**Author:** ![Kevin\_Christopher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevin_christopher/32/86261_2.png) [@Kevin\_Christopher](https://discuss.elastic.co/u/Kevin_Christopher)\
**Post date:** [April 13, 2021, 3:57pm UTC](https://discuss.elastic.co/t/automatic-agent-configuration-options-are-not-working/269862/3 "2021-04-13T15:57:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [April 19, 2021, 12:51pm UTC](https://discuss.elastic.co/t/automatic-agent-configuration-options-are-not-working/269862/4 "2021-04-19T12:51:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kevin\_Christopher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevin_christopher/32/86261_2.png) [@Kevin\_Christopher](https://discuss.elastic.co/u/Kevin_Christopher)\
**Post date:** [April 19, 2021, 4:06pm UTC](https://discuss.elastic.co/t/automatic-agent-configuration-options-are-not-working/269862/5 "2021-04-19T16:06:32Z")

</div>

@Sylvain_Juge

Thanks for the explanation..Understood

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 10, 2021, 12:06pm UTC](https://discuss.elastic.co/t/automatic-agent-configuration-options-are-not-working/269862/6 "2021-05-10T12:06:46Z")

</div>

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