Reputation: 141
Can someone tell me why this Kusto statement in Log Analytics fails with "no tabular statement found"?
let eventcnt = Event
| where TimeGenerated > ago(10m)
I can run this query and a table of data is returned:
Event
| where TimeGenerated > ago(10m)
Upvotes: 14
Views: 25146
Reputation: 1284
App Insights log explorer gave me this error when there was a blank line between variable declaration and use.
let eventcnt = Event
| where TimeGenerated > ago(10m);
eventcnt
let eventcnt = Event
| where TimeGenerated > ago(10m);
eventcnt
Upvotes: 14
Reputation: 83
For other facing this issue, it may as well belong to a missing ";" - a terminator semicolon. For the OP's example, this did not solve it - but it may help others facing the same error message.
Upvotes: 5
Reputation: 25895
RE: your first code snippet: it's like you define a function in your program, but you don't actually do anything else in your program (and you don't call that function in your program).
it's the same with let
statements and queries: if you want to use what you've just defined, you need to include it in your query. for example:
let eventcnt = Event
| where TimeGenerated > ago(10m);
eventcnt
Upvotes: 29