North-Seattle-College / ad440-winter2021-tuesday-repo

NSC AD 440 Winter 2021 Tuesday cohort practicum repo
Apache License 2.0
4 stars 22 forks source link

Create alerts for error 400 generated by the /users/{user_id} API – more than 5 errors 400 within 5 min #320

Closed RealDogDad closed 3 years ago

RealDogDad commented 3 years ago

Task: Create alerts for error 400 generated by the /users/{user_id} API - more than 5 errors 400 within 5 min

Steps to accomplish this:

  1. Go to Azure Portal Application insights resource: https://portal.azure.com/#@nsccloud.onmicrosoft.com/resource/subscriptions/9f4dcf43-aa06-457b-b975-f0216baef20d/resourceGroups/nsc-rg-dev-usw2-tuesday/providers/microsoft.insights/components/nsc-func-dev-usw2-tuesday/overview
  2. Click on "Alerts" in the left-hand menu
  3. Click on "New Alert Rule"
  4. Click on "Add Condition"
  5. Select "Custom Log Search" - insert "search query" (see value below) and condition threshold (5)
  6. Select "Add Action Group" - select the action group (usersUserID)
  7. Fill in Alert name and description
  8. Set Severity to '3'
  9. Click on "Create rule"

Search Query: requests | where resultCode == 400 and timestamp > ago(5m) and cloud_RoleName == "nsc-func-dev-usw2-tuesday" and operation_Name == "HttpTriggerUserId" and success == false and appName == "/subscriptions/9f4dcf43-aa06-457b-b975-f0216baef20d/resourcegroups/nsc-rg-dev-usw2-tuesday/providers/microsoft.insights/components/nsc-func-dev-usw2-tuesday" Confirm: deliverable

Date Activity Time Spent
03/15/2021 Researched Alert Creation 1.5 hours
03/16/2021 Created alert for Error 400 2.5 hours
03/16/2021 Finalized Azure alert 1.25 hours