Azure KUSTO statment fails with "No tabular statement found"
Asked Answered
M

3

12

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)
Morel answered 5/6, 2020 at 20:10 Comment(2)
The actual error message is "No tabular expression statement found"Morel
I often have to delete the default comments in generated KQL statements for them to work. It makes sense to add comments, but doesn't make sense to break the default query as a result.Dudley
D
27

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
Dulcle answered 5/6, 2020 at 20:29 Comment(1)
I forgot the semicolon. Thanks.Staceystaci
F
10

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
Froebel answered 22/6, 2023 at 14:55 Comment(5)
Thanks! You saved a lot of time troubleshooting.India
Can someone explain why the empty line breaks the execution?Bibliogony
this blows my mind...Tarantula
Use // instead of white line works!Apropos
The same thing happens when querying using Azure Data ExplorerJagannath
S
4

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.

Spinifex answered 5/8, 2022 at 9:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.