Home

Query on loganalytics.io not working

Don Koning
New Contributor
As a beginner I'm looking for sample queries to understand how to create my own queries in Log Analytics. I came across the sample below and it seems to do what I need. However the query fails when run with error: 

"No query statement found"

 

Any thoughts on why this unmodified sample doesn't work (anymore)?

let ComputersMissingUpdates3DaysAgo = Update
| where TimeGenerated between (ago(3d)..ago(2d))
| where  Classification == "Critical Updates" and UpdateState != "Not needed" and UpdateState != "NotNeeded"
| summarize makeset(Computer);
Update
| where TimeGenerated > ago(1d)
| where  Classification == "Critical Updates" and UpdateState != "Not needed" and UpdateState != "NotNeeded"
| where Computer in (ComputersMissingUpdates3DaysAgo)
| summarize UniqueUpdatesCount = dcount(Product) by Computer, OSType

 

/D

2 Replies

Hi Don,

That error means the query was not "found" when you clicked the "Run" button, and that's usually because the cursor was on an empty line. Try placing the query editor's cursor anywhere on the query text itself, and then click "Run".

On another note, we have many examples you can use:

1. On our examples GitHub repo

2. Now available "Select queries" on the Azure Log Analytics "Logs" page (also available through Help->Examples)

Examples.png

 

HTH,

Noa

Unless I remove the empty line before Update, or ctrl-a to select all it doesn't work when placing the cursor at the start of the query, but then it works. Thx.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies