Consolidate azure container apps alert query to setup alert on all container apps

Subu 0 Reputation points
2025-02-18T21:13:58.08+00:00

Hi,

We would like to write alert queries for all container apps in a single place which will conver all the container apps with the name (regex or wildcard pattern).

We dont want to create alert rules for common resources like cpu, memory and disk thresholds. We would like to consolidate the alert rules into central location.

Could you please guide us and provide if any documentation available.

Thanks

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,480 questions
Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
543 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Chiugo Okpala 620 Reputation points MVP
    2025-02-19T05:06:50.7066667+00:00

    @Subu

    To consolidate alert queries for all Azure Container Apps into a single place, you can use Azure Monitor and Log Analytics. Here's a step-by-step guide to help you set up consolidated alert rules:

    Step-by-Step Guide to Consolidate Alerts

    1. Create a Log Analytics Workspace:
      • If you don't already have a Log Analytics workspace, create one in the Azure portal.
    2. Enable Diagnostics for Container Apps:
      • Navigate to your Container Apps in the Azure portal.
      • Go to the "Diagnostics settings" and enable diagnostics to send logs to your Log Analytics workspace.
    3. Write Log Analytics Queries:
      • Use Kusto Query Language (KQL) to write queries that match your alert criteria.
      • For example, to monitor all container apps with a specific name pattern, you can use a query like:
    ContainerAppLogs
    | where ContainerAppName matches regex "your-regex-pattern"
    | summarize count() by ContainerAppName
    
    

    4.Create Log Alert Rules:

    • In the Azure portal, go to "Monitor" > "Alerts" > "New alert rule".
    • Select your Log Analytics workspace as the resource.
    • Under "Condition", select "Custom log search" and enter your KQL query.
    • Define the alert logic (e.g., trigger when the count exceeds a threshold).
    • Set the alert details, such as name, description, and severity. 5. Use Action Groups:
    • Create or use existing action groups to define what actions should be taken when an alert is triggered (e.g., send an email, trigger a webhook).
      1. Test and Validate:
    • Test your alert rules to ensure they are working as expected.
    • Adjust the queries and alert logic as needed.

    Documentation and Resources

    These resources above provide detailed information on setting up and managing alerts in Azure Container Apps.

    0 comments No comments

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.