An administrator needs to write a Kusto Query Language (KQL) query in a Log Analytics workspace. The query must retrieve all heartbeat records for a virtual machine named VM1 that were generated in the last 24 hours.
Which two KQL queries meet these requirements? Select two.
- `Heartbeat | where Computer == "VM1" and TimeGenerated > ago(24h)`Cevap
- `Heartbeat | where TimeGenerated >= ago(24h) | where Computer == "VM1"`Cevap
- C`SELECT * FROM Heartbeat WHERE Computer = 'VM1' AND TimeGenerated > ago(24h)`
- D`Heartbeat | where Computer = "VM1" | where TimeGenerated > 24h`
Cevap
The correct queries are the ones starting with 'Heartbeat | where Computer == "VM1" and TimeGenerated > ago(24h)' and 'Heartbeat | where TimeGenerated >= ago(24h) | where Computer == "VM1"'.
The queries that retrieve the correct records are the query utilizing the 'and' operator within a single filter and the query chaining two separate 'where' clauses. Both configurations correctly filter the Heartbeat logs by the specified computer name and within the past 24 hours using the 'ago()' function.
Adım Adım Çözüm
Anahtar Kavram
Writing basic queries in Log Analytics using KQL table operators, where clauses, comparison operators, and time functions.