I want to create a clean and optimized KQL query in Azure Log Analytics to show only the status/health of Azure Event Hub Namespaces.

Amit Kumar 0 Reputation points
2026-05-25T09:18:48.63+00:00

The query should:

  • Display Event Hub Namespace name
  • Show current status/availability
  • Indicate whether the namespace is Healthy, Unavailable, or Failed
Azure Event Hubs

2 answers

Sort by: Most helpful
  1. kagiyama yutaka 5,085 Reputation points
    2026-05-27T06:04:28.1066667+00:00

    I think the health for Event Hub namespaces is taken from the public HealthResources table and its availabilityState, and KQL can show the namespace name and that state by filtering Microsoft.EventHub/namespaces.

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-05-25T09:19:01.0666667+00:00

    Use Azure Resource Graph with the Azure Resource Health table to get the availability state of Event Hubs namespaces.

    Example KQL (for Azure Resource Graph / Log Analytics with HealthResources):

    HealthResources
    | where type =~ 'microsoft.resourcehealth/availabilitystatuses'
    // Keep only Event Hubs namespaces
    | where tostring(properties.targetResourceType) =~ 'Microsoft.EventHub/namespaces'
    // Extract fields of interest
    | extend 
        NamespaceName = tostring(properties.targetResourceName),
        AvailabilityState = tostring(properties.availabilityState)
    // Map availability state to a simple health label
    | extend HealthStatus = case(
        AvailabilityState =~ 'Available', 'Healthy',
        AvailabilityState =~ 'Unavailable', 'Unavailable',
        AvailabilityState =~ 'Degraded', 'Degraded',
        AvailabilityState =~ 'Unknown', 'Unknown',
        'Failed')
    // Select and sort columns
    | project NamespaceName, AvailabilityState, HealthStatus, subscriptionId
    | order by NamespaceName asc
    

    Explanation of columns:

    • NamespaceName: Event Hub Namespace name.
    • AvailabilityState: Raw Azure Resource Health state.
    • HealthStatus: Simplified status label (Healthy / Unavailable / Failed/Degraded/Unknown).

    Run this query via Azure Resource Graph (for example with az graph query or Search-AzGraph) or in any Log Analytics context where the HealthResources table is available.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

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