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

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!


-Delastic.apm.capture_body=all -Delastic.apm.capture_body_content_types=application/x-www-form-urlencoded*, text/, application/json, application/xml

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.


Let me know if that helped :slight_smile:

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!


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