How to log entire Proxy Request, Proxy Response, Target Request and Target Response to Third Party systems like Loggly?

Not applicable

I want to log entire request and response messages to Loggly. I tried with MessageLogging policy and used variables to log my interested content but {request} or {request.content} is not working.

If I use {request.queryparam.w} as given in Apigee documentation it works. But if I use, request or request.content then it's not working.

Solved Solved
1 6 2,281
1 ACCEPTED SOLUTION

Not applicable

The complete list of flow variables available to you can be found here. The list is fairly extensive, so you should be able to find what you're looking for. Let us know if you have any further questions or problems.

View solution in original post

6 REPLIES 6

Not applicable

Do you want to log the uri that is being called in the request or just the body of the request?

Hi Michael,

I want to log RAW http messages received at Proxy endpoint, target endpoint and response message sent from target endpoint, proxy endpoint. So it includes everything like http header, body, if SOAP request, response then entire message etc.

i tried with {request} and {request.content} variable it did not work but {response.content} worked.

Not applicable

The complete list of flow variables available to you can be found here. The list is fairly extensive, so you should be able to find what you're looking for. Let us know if you have any further questions or problems.

Hi Michael,

Thanks for the response. In the variable reference list I found {request} as a one option. I tried it but its logging hashcode of request object like " Message@21379871" etc.

I want to log entire request, response with headers, body like http status, content type, payload, request timestamps etc. I am able to achieve logging everything but it requires to add individual variable. I want to log everything with just one variable. My thinking is that {request} should do that but instead its giving me object hashcode value that is has no concern to apigee users (API developer).

Unfortunately, there is not one flow variable that has all of the information you are looking to log. I think you are doing the best that you can do by logging the individual variables.

Not applicable

As Michael says your best bet is to extract specific elements of the request or response you want to include in your log payload.

The entire request or entire response is NOT available in a single variable - hence context.getVariable("request") will not return anything meaningful while context.getVariable("request.queryparam.w") will.

Some collections are available such as request.queryparams.names which returns all the queryparams on the request. But generally you will have to build this yourself (typically in a Javascript callout).