9

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)
Yoni L.
  • 22,627
  • 2
  • 29
  • 48
jpsebasti
  • 91
  • 1
  • 1
  • 2

3 Answers3

25

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
Yoni L.
  • 22,627
  • 2
  • 29
  • 48
3

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.

2

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
Rachel
  • 686
  • 1
  • 6
  • 18