microsoft / microsoft/AzureMonitorCommunity

KQL bug in Events queries

Open
#257 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1.2k
Forks
493
PR merge metrics
No merged PRs in 30d

Description

The query for "Warning events" has a case-sensitive KQL error and does not retrieve any results.

Warning events.kql:9

Events
| where EventLevelName == "warning"  // this does not work
| sort by TimeGenerated desc

Sampled values for the EventLevelName field are "Information", "Warning", "Error".

A likely source of this code sample is the Azure Monitor Reference page for the Event table.

I propose using a case-insensitive match for the field:

Events
| where EventLevelName =~ "Warning" 

The pattern can be found in several query files in this repo, for example:

  1. Azure Services/Virtual machines/Queries/Errors/Error event on computer missing security co critical update.kql
  2. Solutions/LogManagement/Queries/Diagnostics/Count of warning events.kql
  3. Solutions/LogManagement/Queries/Diagnostics/Warning events.kql

Here are screenshots illustrating the values of EventLevelName.

Image
Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open Solutions/LogManagement/Queries/Diagnostics/Warning events.kql and inspect line 9, then compare it with Count of warning events.kql and the other referenced query. Update the EventLevelName comparison so it matches the sampled "Warning" value case-insensitively, and confirm the Warning events query returns results.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
observability-sre
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.