cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Capture Response Body as Request Attribute (NGINX)

gary1024
Frequent Guest

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 documentation does not really mention on this. Is there a way to capture this as an attribute?

 

Gary

3 REPLIES 3

Romanenkov_Al3x
DynaMight Pro
DynaMight Pro

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

DT_NGINX_FORCE_UNKNOWN_VERSION_INSTRUMENTATION=1

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. 

 

cesarsaravia
Dynatrace Mentor
Dynatrace Mentor

Hello @gary1024 

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

Business Events
Dynatrace Grail
Dynatrace Query Language

BR,

-César S. - LATAM Solutions Architect

Featured Posts