jpsebasti
jpsebasti

Reputation: 141

Azure KUSTO statment fails with "No tabular statement found"

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

Answers (3)

Rachel
Rachel

Reputation: 1284

App Insights log explorer gave me this error when there was a blank line between variable declaration and use.

Works

let eventcnt = Event
| where TimeGenerated > ago(10m);
eventcnt

Doesn't work

let eventcnt = Event
| where TimeGenerated > ago(10m);

eventcnt

Upvotes: 14

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

Yoni L.
Yoni L.

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

Related Questions