# Java apm agent doesn't capture text or json body

**URL:** <https://discuss.elastic.co/t/java-apm-agent-doesnt-capture-text-or-json-body/324064>\
**Category:** APM\
**Tags:** java\
**Created:** [January 26, 2023, 7:12pm UTC](https://discuss.elastic.co/t/java-apm-agent-doesnt-capture-text-or-json-body/324064 "2023-01-26T19:12:02Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Jonas\_Kunz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonas_kunz/32/110740_2.png) [@Jonas\_Kunz](https://discuss.elastic.co/u/Jonas_Kunz)\
**Post date:** [January 30, 2023, 11:12am UTC](https://discuss.elastic.co/t/java-apm-agent-doesnt-capture-text-or-json-body/324064/4 "2023-01-30T11:12:13Z")

</div>

Ok, the logs do not indicate any reason why the agent is actively not capturing the body.

Does your application consume the incoming request body? E.g. does your spring controller have something like a `@RequestBody String content` parameter?

The agent decides on whether or not to capture the body [here](https://github.com/elastic/apm-agent-java/blob/73b62624cfa4e095b1a6241ac11bac046dc096f1/apm-agent-plugins/apm-servlet-plugin/src/main/java/co/elastic/apm/agent/servlet/ServletTransactionHelper.java#L126). Based on that decision the `ServletRequest`'s `getInputStream` is wrapped [here](https://github.com/elastic/apm-agent-java/blob/cb870b072523f83c56669ba8f4cabc3b48f79c44/apm-agent-plugins/apm-servlet-plugin/src/main/java/co/elastic/apm/agent/servlet/JavaxRequestStreamRecordingInstrumentation.java#L60) with a stream which copies the data to the transaction. So if your application does not consume the input stream, no data will be recorded on the transaction.

If you are already debugging yourself with the agent source code, these two code locations might allow you to locate the issue.

---

_[View the full topic](https://discuss.elastic.co/t/java-apm-agent-doesnt-capture-text-or-json-body/324064)._
