![]() ![]() Keep in mind contextRequestUser is expecting a base64 encoded string. By default, the XML policy also saves Email, FirstName, and LastName from Azure’s context.User object. String, The field contextRequestUser allows you to store additional user metadata as part of the user’s profile in Moesif. See identifying customers in Moesif for more info. If you are a B2B company, this can be used simultaneously with company id to track API Usage both at the individual user-level and also account-level. The default XML policy extracts the user id from the or the Subject of the JWT Token. ![]() String, The field user_id identifies who the user is making the API and enables Moesif to associate API calls to user profiles. XML Policies support a number of context variables which you can also leverage. The below fields in the XML policy can be modified by you to meet your requirements. Once the XML is added to your APIs, the logs should start showing up in Moesif. New JProperty("response_body", responseBody) New JProperty("contextTimestamp", (context.Elapsed).ToString("o")), New JProperty("response_headers", string.Join(" ", headers)), New JProperty("message-id", context.Variables), New JProperty("orig_body_len", origBodyLen), Var responseBody = (body != null ? 64String((body)) : string.Empty) ![]() If (MAX_BODY_EH h.Key != "Ocp-Apim-Subscription-Key"). Var origBodyLen = (null != body) ? body.Length : 0 More info on editing APIM policies is available on the Azure docs Select Other Policies which will open the XML editor. Under the Inbound Processing section, click the Add Policy button. Then, use Moesif dynamic sampling to control what data is collected based on user behavior or regex rules. It’s recommended to add the XML policy globally for all APIs to reduce code replication. Select either a single API you want to add Moesif logging to, or select All APIs to add Moesif globally. Within the Azure portal, navigate to your existing Azure API Management instance. If you still have issues after last step, view troubleshooting. We recommend proceeding with rest of process. Occasionally, Azure reports a failed deployment due to slow propagation of new DNS settings even though everything was deployed successfully. Once done, click the Review+create button at the bottom and finish the template creation wizard. If blank, you will need to manually create the APIM logger. Set Existing Api Mgmt Name to the name of your Azure APIM instance. You can create a free one on Moesif’s website Set Moesif Application Id to the one displayed after logging into your Moesif account. This ensures the APIM logger, moesif-log-to-event-hub, is automatically created for you. Set Resource group to the same resource group that contains your existing Azure APIM instance. Within the Azure Template Deployment panel, set the following properties: Start Azure Resource DeploymentĬlick the below button to start a Custom deployment with the Moesif Azure Resource Template. An Azure WebJob reads from the EventHub and sends to Moesif for data processing. An XML Policy configures an APIM logger to send API logs to an Azure EventHub. This solution is deployed using an Azure Resource Manager Template. The integration also provides visibility into rejected requests that never reach your underlying service. This template will log API traffic from Azure API Management using Moesif API Analytics & Monetization in a few minutes without any code changes or restarts. With Moesif, grow and monetize your API products with a powerful API analytics and billing platform. json Moesif API Analytics and Monetization.UrlFragment: api-management-logs-to-moesif-using-eventhub-webapp Steps performed by the Azure Resource Templateĭescription: The template will log API calls from Azure API Management to Moesif API analytics and monetization platform. ![]()
0 Comments
Leave a Reply. |