Reputation: 201
The Flag Ocp-Apim-Trace
has been set to true
.
The API Response displays this information under the Trace Tab:
Trace location was not specified in the response or trace log is not available.
Yet no traces are available. How does one resolve this?
Upvotes: 14
Views: 21735
Reputation: 902
You need to enable "Allow tracking" on the subscription whose key you are using and then pass the header Ocp-Apim-Trace to true.
Upvotes: 1
Reputation: 361
To enable trace, you need to include "Ocp-Apim-Trace" and "Ocp-Apim-Subscription-Key" in request header.
If the API does not require subscription, you can still get admin subscription key in developer portal. This enforces that only admin can get tracing log. To get admin subscription key if you are an admin, go to Developer Portal -> Profile -> find your target API and copy the key.
Upvotes: 14
Reputation: 201
Just setting the flag Ocp-Apim-Trace to true will not suffice. One needs to set the subscription key as well as per this doc.
https://learn.microsoft.com/en-us/azure/api-management/api-management-advanced-policies#Trace
So, for API's which do not have a subscription key, not sure how one can get the traces
Upvotes: 2
Reputation: 3266
The Ocp-Apim-Trace feature enables you to specify whether or not APIM should generate a trace file on blob storage.
Setting the header to 'true' within Postman for example, will give you back a HTTP Header in the response called Ocp-Apim-Trace-Location. This will contain the URL to your trace file, which you can open in any browser.
You might want to install a plugin/extension to be able to format JSON files properly in order to make it easy to read.
Upvotes: 3