# Capture Response Body as Request Attribute (NGINX)

**URL:** <https://community.dynatrace.com/t/capture-response-body-as-request-attribute-nginx/38447>\
**Category:** Open Q&A\
**Tags:** nginx, request-attributes\
**Created:** [February 15, 2023, 6:14am UTC](https://community.dynatrace.com/t/capture-response-body-as-request-attribute-nginx/38447 "2023-02-15T06:14:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gary1024](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/gary1024/32/30648_2.png) [@gary1024](https://community.dynatrace.com/u/gary1024)\
**Post date:** [February 15, 2023, 6:14am UTC](https://community.dynatrace.com/t/capture-response-body-as-request-attribute-nginx/38447/1 "2023-02-15T06:14:16Z")

</div>

We have request on Nginx that always reply response 200 but need to look into response body to capture status of ‘fail’ or ‘success’.

},

“response”: {

“statusCode”: 200,

“body”: “{\“message\”:null,\“responseData\”:{\“accountList\”:[{\“accountNo\”:\“2491011751\”,\“canAddNewLine\”:true,\“msisdnList\”:[]}],\“deviceAdvancePaymentWaive\”:\“N\”,\“ratePlanAdvancePaymentWaive\”:\“Y\”,\“lineDepositWaive\”:\“Y\”,\“newProductOfferId\”:\“4062147\”,\“deviceDAPAmount\”:\“540\”,\“orderAck\”:\“Y\”},\“status\”:\“fail\”,\“timeStamp\”:\“2023-02-14 01:37:05\”,\“violations\”:null}”

}

}

However, looking at [request attributes](https://www.dynatrace.com/support/help/how-to-use-dynatrace/transactions-and-services/request-attributes/?_ga=2.8993333.1213700583.1676349096-1383387063.1673310017) documentation does not really mention on this. Is there a way to capture this as an attribute?

Gary

---

<div class="post-metadata">

**Author:** ![Romanenkov\_Al3x](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/romanenkov_al3x/32/36257_2.png) [@Romanenkov\_Al3x](https://community.dynatrace.com/u/Romanenkov_Al3x)\
**Post date:** [February 15, 2023, 6:53am UTC](https://community.dynatrace.com/t/capture-response-body-as-request-attribute-nginx/38447/2 "2023-02-15T06:53:03Z")

</div>

Hello Gary.

We often set a request attribute for capturing arguments\return value from classes and methods which work with body \ make body response on App server level (on a Java backend for example) In this situation.

With custom error rules you can set to mark requests which have 200 response code and request attribute - error: value as failed.

Nginx in our situation is only balancer or web server to serve static files.

Regards,

Romanenkov Alex

---

<div class="post-metadata">

**Author:** ![frank\_hahn](https://avatars.discourse-cdn.com/v4/letter/f/f4b2a3/32.png) [@frank\_hahn](https://community.dynatrace.com/u/frank_hahn)\
**Post date:** [November 22, 2023, 6:05pm UTC](https://community.dynatrace.com/t/capture-response-body-as-request-attribute-nginx/38447/3 "2023-11-22T18:05:30Z")

</div>

Hi,

This sounds like a solution to the problems that we have now. Can you elaborate a bit more on the configuration through step by step? I looked at the custom error rules but would like to see a proper values to be input to harvest them as request attribute values.

---

<div class="post-metadata">

**Author:** ![cesarsaravia](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/cesarsaravia/32/12818_2.png) [@cesarsaravia](https://community.dynatrace.com/u/cesarsaravia)\
**Post date:** [November 22, 2023, 8:52pm UTC](https://community.dynatrace.com/t/capture-response-body-as-request-attribute-nginx/38447/4 "2023-11-22T20:52:51Z")

</div>

Hello&nbsp;[@gary1024](https://community.dynatrace.com/user/13094)

Maybe you could try to use bizEvents with Grail on the Dynatrace Platform.  
Capture the full body of nginx is possible and then you can use Dynatrace Query Language with Notebooks or Dashboards to make it graphically.

 ![cesarsaravia_0-1700686175856.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/a/1a9628bdc003091d96e98c6ef8d5d30c4492bc21.png)

[Business Events](https://docs.dynatrace.com/docs/shortlink/ba-business-events-capturing)  
[Dynatrace Grail](https://docs.dynatrace.com/docs/platform/grail)  
[Dynatrace Query Language](https://docs.dynatrace.com/docs/shortlink/dql-dynatrace-query-language-hub)

BR,
