Cato0293
Cato0293

Reputation: 25

Why is the same query syntax not supported in Log Analytics and Application Insight Logs?

I am trying to figure out why the same query is not valid in both a Log Analytics and Application Insights workspace.

I've been working on creating a cross-resource query and when I write the syntax in Log Analytics it has a syntax error around the workspace operator. It is successful when I do the same thing in an Application Insights query.

The query looks like this:

union 
workspace("DefaultWorkspace-b432aa91-rrrr-qqqq-zzzz-aabbba7e8f42-WUS2").SecurityEvent
,workspace("DefaultWorkspace-fca02198a-aaaa-eeee-cccc-aaad9fbf7302-EUS").SecurityEvent 
| count 

Since in both workspaces it references other workspaces, I would think it would be portable if queried under the same tenant (which I am). In Azure Log Analytics it gives me the error:

Unknown function: 'workspace'.

I am running these in the Azure portal at the moment.

Upvotes: 0

Views: 867

Answers (3)

Cato0293
Cato0293

Reputation: 25

I tried the same statement 2 weeks later in both an Application Insights and Log Analytics and it works in both.

Upvotes: 0

Ivan Glasenberg
Ivan Glasenberg

Reputation: 29940

This is not a direct answer, but suggestions.

As far as I know, only if the query missing table name, then it will cause the error "Unknown function: 'workspace'.". Like below:

enter image description here

So first, make sure in your query, you are adding table name after workspace("xxx"). I notice that in your query, you're using the correct syntax, but just want to make sure the table name is there.

Second, if you're adding table name after workspace("xxx"), and still get this error. You can try just use the query below to check if the workspace("xxx") works:

workspace("adsmit-test").Heartbeat
| count

Please feel free to let me know if you still have the issue.

Upvotes: 0

Lou Godmer
Lou Godmer

Reputation: 1

Can you try adding a space after the comma? This query is working for my own workspaces.

union workspace("DefaultWorkspace-b432aa91-rrrr-qqqq-zzzz-aabbba7e8f42-WUS2").SecurityEvent , workspace("DefaultWorkspace-fca02198a-aaaa-eeee-cccc-aaad9fbf7302-EUS").SecurityEvent | count

Upvotes: 0

Related Questions