# \[APM AGENT\]\[JAVA\] Doubt about multiple body content types

**URL:** <https://discuss.elastic.co/t/apm-agent-java-doubt-about-multiple-body-content-types/190694>\
**Category:** APM\
**Tags:** java\
**Created:** [July 16, 2019, 9:17am UTC](https://discuss.elastic.co/t/apm-agent-java-doubt-about-multiple-body-content-types/190694 "2019-07-16T09:17:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ea1987](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ea1987/32/51356_2.png) [@ea1987](https://discuss.elastic.co/u/ea1987)\
**Post date:** [July 16, 2019, 9:17am UTC](https://discuss.elastic.co/t/apm-agent-java-doubt-about-multiple-body-content-types/190694/1 "2019-07-16T09:17:08Z")

</div>

ELK stack version: 7.2  
APM Java agent: 1.7.0

Hi guys, I have 2 different web services (RESTful and SOAP) exposed by the same JVM. I would like to capture both different request body (application/json and text/xml;charset=UTF-8).  
I tried the following options:

-Delastic.apm.capture\_body=all -Delastic.apm.capture\_body\_content\_types=application/json\*, text/xml\* -\> I can capture only json body

-Delastic.apm.capture\_body=all -Delastic.apm.capture\_body\_content\_types=text/xml\* -\> -\> I can capture only xml body

-Delastic.apm.capture\_body\_content\_types=application/x-www-form-urlencoded\*, text/_, application/json, application/xml_ -\> it doesn't capture both types

Since this property is list type, I'm wondering how should I set it properly in order to capture both body types at the same time.

Thank you!

Andrea

-Delastic.apm.capture\_body=all -Delastic.apm.capture\_body\_content\_types=application/x-www-form-urlencoded\*, text/_, application/json, application/xml_

---

<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:** [July 16, 2019, 1:19pm UTC](https://discuss.elastic.co/t/apm-agent-java-doubt-about-multiple-body-content-types/190694/2 "2019-07-16T13:19:22Z")

</div>

My best guess is that when you set `-Delastic.apm.capture_body_content_types=application/json*, text/xml*`, it doesn't count in `text/xml*` because of the whitespace. The agent supports putting a whitespace after the comma but due to console escaping, the value of the system property will probably be `application/json*,`. So I'd advise to either get rid of the comma or to appropriately quote the value. I'm not 100% sure what the correct quoting would be. Probably either `-Delastic.apm.capture_body_content_types="application/json*, text/xml*"` or `"-Delastic.apm.capture_body_content_types=application/json*, text/xml*"`.

However, the default value is `application/x-www-form-urlencoded*, text/*, application/json*, application/xml*` which contains all of that.

To confirm what options the agent had recognized, set the `log_level` to `debug` which will cause the agent to log all the options when it starts.

Cheers,  
Felix

---

<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:** [July 18, 2019, 7:19am UTC](https://discuss.elastic.co/t/apm-agent-java-doubt-about-multiple-body-content-types/190694/3 "2019-07-18T07:19:45Z")

</div>

Let me know if that helped 🙂

---

<div class="post-metadata">

**Author:** ![ea1987](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ea1987/32/51356_2.png) [@ea1987](https://discuss.elastic.co/u/ea1987)\
**Post date:** [July 19, 2019, 5:39pm UTC](https://discuss.elastic.co/t/apm-agent-java-doubt-about-multiple-body-content-types/190694/4 "2019-07-19T17:39:52Z")

</div>

Hi Felix,  
Thank you for your suggestion! Right now it seems to work fine but I have to test different setup. Will definitely confirm in the next week!  
Have a great weekend!

Andrea

---

<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:** [August 9, 2019, 1:39pm UTC](https://discuss.elastic.co/t/apm-agent-java-doubt-about-multiple-body-content-types/190694/5 "2019-08-09T13:39:58Z")

</div>

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