When using Azure Spring Cloud, sometimes we need to monitor a specific App's Ingress request log to investigation app performance issue.
Azure Spring Cloud platform provides AppPlatformIngressLogs to query Ingress request log for those Apps with endpoint enabled.
But for the Apps with endpoint disabled, since the traffic is not going through the platform load balancer, the ingress request log is not recorded. For such cases, to monitor the App access log, we can use Application Performance Monitoring (APM) tools like Application Insights.
In this blog, let's demonstrate how to use AppPlatformIngressLogs and Application Insights to monitor both types of request access log.
A Brief Description of the sample test Apps
In my test Azure Spring Cloud, I created two Apps, "hello" and "number-service".
The "hello" App has URL endpoint enabled. All the external incoming requests will only hit this "hello" App.
When this "hello" App receives a client request, it will: 1. Send an internal App to App call to "number-service", get a random number from it 2. Response the client with a message: "Got a random number xx from App number-service"
The "number-service" App disabled URL endpoint, it only expects internal App to App calls coming from the "hello" App.
Use AppPlatformIngressLogs to monitor App Ingress request log
We can use AppPlatformIngressLogs table to query all the ingress request log for those Apps with endpoint enabled. The followings are the detailed steps of how to check the access log.
1. Make sure the App has endpoint enabled.
2. Enable "IngressLogs" in the "Diagnostic setting" Portal.
4. Use the following query to check the Ingress request log.
| where TimeGenerated >= datetime(2022-04-20 06:00:00)
| where Host == "<springcloud-name>-<app-name>.azuremicroservices.io"
| project TimeGenerated, TimeLocal,Host, Request, Status, RequestTime
| order by TimeGenerated asc
Use Application Insights to monitor App request log
For those App to App calls, since they are not travel through the platform load balancer, traffic are not recorded in AppPlatformIngressLogs. But we can check the requests in APM tools like Application Insights.
1. Make sure we enabled the Application Insights for the Azure Spring Cloud service.
2. Go to Application Insights -> Performance portal to check the request log.
We can select Role = <App-name> to check one specific App's access request log.
3. Pick the Samples requests to dig deeper, you can see more details about the Http(s) requests For example, I pick one of the requests sent to my "hello" App. We can see it made an internal call to "number-service" App's "/number/random" API to get a random number.
4. We can also use "Application map" to get an overview of the traffic between the Apps, Eureka servers and target outside the Azure Spring Cloud service. In this test, we can see：
- App "hello" is calling App "number-service". - Both Apps also need to register themselves to Eureka server. So both of them are also calling the Eureka.