Skip to content

KQL bug in Events queries #257

@s4parke

Description

@s4parke

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions