Soru

Zorluk: KolayLog Analytics Workspaces and KQL Queries

An administrator needs to write a Kusto Query Language (KQL) query in a Log Analytics workspace. The query must retrieve all records from the AzureActivity table where the Level column is equal to "Error" and the event occurred within the last 24 hours.

Which two of the following KQL queries will retrieve the required records? (Select two.)

  1. AzureActivity
    | where Level == "Error" and TimeGenerated > ago(24h)
    Cevap
  2. AzureActivity
    | where TimeGenerated > ago(1d)
    | where Level == "Error"
    Cevap
  3. C
    AzureActivity
    | filter Level == "Error" and TimeGenerated > ago(24h)
  4. D
    AzureActivity
    | where Level = "Error" and TimeGenerated > ago(24h)

Cevap

The correct queries are the ones that use the where operator with the double equals comparison, either as a single compound expression or as sequential where clauses.
The correct KQL queries use the where operator to filter the records and the double equals (==) operator to evaluate equality on the Level column. They also correctly utilize the ago function to filter the TimeGenerated column, using either 24h or 1d as the duration. Consecutive where clauses in KQL act as a logical AND.

Adım Adım Çözüm

1
Identify the correct operator for filtering rows in KQL.
The where operator is used for filtering. The filter operator is invalid.
KQL uses the where operator to filter rows based on conditions.
2
Determine the correct equality comparison operator in KQL.
The double equals (==) operator must be used.
A single equals (=) operator is reserved for assignment in KQL, such as when creating new columns.
3
Evaluate the time filter condition for the last 24 hours.
Both ago(24h) and ago(1d) are valid expressions representing the past 24 hours.
The ago function calculates the offset from the current UTC time.

Anahtar Kavram

Filtering and basic syntax rules in Kusto Query Language (KQL)
Bu soruyu puanla