# Java APM - logstash output

**URL:** <https://discuss.elastic.co/t/java-apm-logstash-output/290054>\
**Category:** APM\
**Tags:** server\
**Created:** [November 24, 2021, 11:34am UTC](https://discuss.elastic.co/t/java-apm-logstash-output/290054 "2021-11-24T11:34:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SanderP](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@SanderP](https://discuss.elastic.co/u/SanderP)\
**Post date:** [November 24, 2021, 11:34am UTC](https://discuss.elastic.co/t/java-apm-logstash-output/290054/1 "2021-11-24T11:34:10Z")

</div>

**APM Agent language and version** :  
Java - 1.27.0

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:  
Standalone java agent

**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.  
APM agent -\> logstash

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:  
Is there an option to sent APM data to logstash in beats format? The server\_url seems only to be allowed to be sending data to Elasticsearch directly. As a workaround a http input with json codec is possible, but I'm still wondering if it should be possible and/or if I am thinking about this wrong

**Provide logs and/or server output (if relevant)**:  
When APM is trying to use beats: "invalid version of beats protocol"

---

<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:** [November 24, 2021, 1:32pm UTC](https://discuss.elastic.co/t/java-apm-logstash-output/290054/2 "2021-11-24T13:32:45Z")

</div>

Hi @SanderP ,

Unlike Beats, the APM agents do not communicate directly to Elasticsearch,they have to send their data to APM server.

In agent configuration `server_url` should point to an APM Server, which is itself configured to write to Elasticsearch through `output.elasticsearch` configuration (see [doc](https://www.elastic.co/guide/en/apm/server/current/configuration-process.html)).

---

<div class="post-metadata">

**Author:** ![SanderP](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@SanderP](https://discuss.elastic.co/u/SanderP)\
**Post date:** [November 24, 2021, 1:46pm UTC](https://discuss.elastic.co/t/java-apm-logstash-output/290054/3 "2021-11-24T13:46:54Z")

</div>

Hi @Sylvain_Juge

Sorry indeed, thanks! Not ES, but the APM Server. Can pass through logstash instead?  
We don't have all servers allowed to access the Internet. If not, then as a workaround I should host the apm\_server myself (instead of the current apm within Elastic Cloud) and point that one to ES within Elastic Cloud?

edit: At least there was a thinking error. Installing apm-server manually works indeed for me as a bypass to the Internet (output ES Cloud). I would prefer currently to use logstash as a middleware which sends data to the Cloud APM Server which put the data in ES in the same deployment to have the server managed there.

---

<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:** [November 25, 2021, 8:37am UTC](https://discuss.elastic.co/t/java-apm-logstash-output/290054/4 "2021-11-25T08:37:35Z")

</div>

There is no way to make APM server use logstash as gateway to send data.

As an alternate option, maybe using an HTTP proxy next to logstash that allows to only send APM data should be simpler to maintain that using your own apm-server deployment and write directly to ES.

But, I'm really not familiar with all the deployment options here, maybe there is a simpler way to handle such case.

---

<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:** [December 16, 2021, 4:37am UTC](https://discuss.elastic.co/t/java-apm-logstash-output/290054/5 "2021-12-16T04:37:58Z")

</div>

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