# APM Agent not able to send in logs to APM Server error: Connection refused

**URL:** <https://discuss.elastic.co/t/apm-agent-not-able-to-send-in-logs-to-apm-server-error-connection-refused/228503>\
**Category:** APM\
**Tags:** java, server\
**Created:** [April 17, 2020, 11:42am UTC](https://discuss.elastic.co/t/apm-agent-not-able-to-send-in-logs-to-apm-server-error-connection-refused/228503 "2020-04-17T11:42:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![devops-ps](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@devops-ps](https://discuss.elastic.co/u/devops-ps)\
**Post date:** [April 17, 2020, 11:42am UTC](https://discuss.elastic.co/t/apm-agent-not-able-to-send-in-logs-to-apm-server-error-connection-refused/228503/1 "2020-04-17T11:42:55Z")

</div>

**Kibana version** : 7.6.2

**Elasticsearch version** : 7.6.2

**APM Server version** : 7.6.2

**APM Agent language and version** : Java 1.15.0

**Browser version** : Google Chrome Version 80.0.3987.122 (Official Build) (64-bit)

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**: Official Deb from [here](https://www.elastic.co/guide/en/elastic-stack/current/installing-elastic-stack.html)

**Fresh install or upgraded from other version?** Fresh

**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 have my Elastic stack installed on an AWS instance. Kibana is running fine and confirms successful connection between ES and APM-Server. So, my Elastic Stack is running all good.

I have my Java application running in a Tomcat server hosted on another AWS instance in the same VPC as my Elastic stack, and have configured the setenv.sh file as instructed [here](https://www.elastic.co/guide/en/apm/agent/java/current/setup-javaagent.html#setup-tomcat).

When I restarted my tomcat server, i should start getting data in APM-Server, but in the apm-agent logs I see the below error :

```
2020-04-16 14:54:50.445 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type SPAN with this error: Connection refused (Connection refused)
2020-04-16 14:54:50.446 [elastic-apm-server-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%) 

```

I have used the private IP of my ElasticStack instance while configuring the apm-agent in setenv.sh file in tomcat server.

What should I do, and where should I debug more ?

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

```
2020-04-16 14:54:50.445 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type SPAN with this error: Connection refused (Connection refused)
2020-04-16 14:54:50.446 [elastic-apm-server-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 36 seconds (+/-10%)
```

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [April 17, 2020, 11:55am UTC](https://discuss.elastic.co/t/apm-agent-not-able-to-send-in-logs-to-apm-server-error-connection-refused/228503/2 "2020-04-17T11:55:54Z")

</div>

Hi and welcome to the forum 👋

Check out this section of the troubleshooting guide: [https://www.elastic.co/guide/en/apm/agent/java/current/trouble-shooting.html#trouble-shooting-no-data](https://www.elastic.co/guide/en/apm/agent/java/current/trouble-shooting.html#trouble-shooting-no-data)

---

<div class="post-metadata">

**Author:** ![devops-ps](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@devops-ps](https://discuss.elastic.co/u/devops-ps)\
**Post date:** [April 17, 2020, 12:18pm UTC](https://discuss.elastic.co/t/apm-agent-not-able-to-send-in-logs-to-apm-server-error-connection-refused/228503/3 "2020-04-17T12:18:02Z")

</div>

Hey @felixbarny Thanks for the prompt response. I have tried the troubleshooting steps and couldn't figure out a solution or any other issue more than I have described in my post.

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [April 17, 2020, 12:34pm UTC](https://discuss.elastic.co/t/apm-agent-not-able-to-send-in-logs-to-apm-server-error-connection-refused/228503/4 "2020-04-17T12:34:37Z")

</div>

What happens when you do `curl -v <apm-server-url>`?

---

<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 8, 2020, 8:34am UTC](https://discuss.elastic.co/t/apm-agent-not-able-to-send-in-logs-to-apm-server-error-connection-refused/228503/5 "2020-05-08T08:34:39Z")

</div>

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