microsoft / microsoft/AzureMonitorCommunity
KQL bug in Events queries
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.
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:
- Azure Services/Virtual machines/Queries/Errors/Error event on computer missing security co critical update.kql
- Solutions/LogManagement/Queries/Diagnostics/Count of warning events.kql
- Solutions/LogManagement/Queries/Diagnostics/Warning events.kql
Here are screenshots illustrating the values of EventLevelName.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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