Can we get the availability zone name from app insight or log analytics workspace logs?

Bhargav Pasarla 120 Reputation points
2023-09-21T06:54:37.3133333+00:00

Is it possible to check which specific availability zone has served the request for APIM by checking anywhere like Application insights or LogAnalytics workspace or any other place if any?

Consider there are two availability zones for the APIM in the East US region.

Consider those as AZ1 (eg server ip - 10.198.20.100) and AZ2(Eg server ip - 10.177.21.23)

If the APIM is load balanced for these two zones then in the logs will it log the Availabilty zone's server name - 10.198.20.100 or 10.177.21.23 to know exactly which zone is being hit by request?

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,273 questions
Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,129 questions
{count} votes

Accepted answer
  1. JananiRamesh-MSFT 27,181 Reputation points
    2023-09-26T18:02:06.0333333+00:00

    Hi @Bhargav Pasarla Thanks for reaching out.

    when you deploy APIM in multiple availability zones, Azure automatically replicates your APIM instance across the availability zones and assigns the same public IP address to each instance (So when you say Consider those as AZ1 (eg server ip - 10.198.20.100) and AZ2(Eg server ip - 10.177.21.23) both AZ1 and AZ2 will have same ip address not different). Azure uses a load balancer to distribute incoming traffic across the instances of APIM that are deployed in the availability zones.

    The load balancer monitors the health of each instance of APIM and automatically routes traffic to healthy instances. If one of the instances of APIM becomes unavailable, the load balancer automatically routes traffic to the remaining instances.

    Is it possible to check which specific availability zone has served the request for APIM by checking anywhere like Application insights or LogAnalytics workspace or any other place if any?

    In Azure Log Analytics, you can distinguish which specific APIM instance handled the request by using the cloud_RoleName field. This field is automatically populated with the name of the APIM instance that handled the request.

    But, When APIM is deployed across multiple availability zones, all instances of the APIM service share the same cloud_RoleName because they are part of the same service. This means that the cloud_RoleName field in Log Analytics will not differentiate between different instances of the APIM service in different availability zones.

    Unfortunately, Azure does not provide a built-in way to determine which specific instance of an APIM service (in a specific availability zone) served a request. The load balancer that distributes incoming traffic across the instances is abstracted away and not exposed to users.

    Hope this helps! Please let me know if you have any questions.

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.