Querying ApplicationInsights

Copper Contributor

How should we be querying ApplicationInsights?

 

I don't get Intellisense this way. 

app("Sitecore Production").traces

 

The Schema isn't consistent this way. 

ApplicationInsights
| traces

 

And this just doesn't work at all unless I am in the Application Insights Analytics portal (https://analytics.applicationinsights.io)

traces 

 

Devin

7 Replies

Hi, can i know what are you trying to achieve ?

Devin,

 

If you're querying exclusively Application Insights, please use option 3 (querying from within Application Insights).

 

If you're querying a combination of Log Analytics and Application Insights, please use option #1 from within either the AI or LA portals. IntelliSense support is something high on our backlog, together with a better unification between the two services. Expect to see features around this in the coming months.

 

Option 2 should be considered outdated. I'd turn off the Application Insights connector to both avoid the schema confusion, as well as save yourself some costs from dual-ingesting the data. This feature was originally created as a stop-gap before we had cross-AI-and-LA queries available.

Hello, 

How would I write the query if I wanted to use it for azure alerts, to query though dependencies? I'm currently trying option one listed above, but it is returning an error.image.png

Looks like the data is not been captured in the LA from the VM, please check the following:

 

1. Check if the data is been captured in LA, try with the basic queries to see the data.

2.Agent is properly installed ? if not try to reinstall it in the VM.

3. Check the Internet connectivity in the VM to communicate also port 443 should be opened as by default the internet access is restricted.

 

Hope this should give help you.

The query is working fine in log analytics, and the data is definitely there, but it is still throwing in error, that states: Query syntax error.

app("Sitecore Production").dependencies
|where
target !contains "brightcove"
and target !contains "sitecore1.maxmind.com"
and target !contains "lkqd"
|summarize
Failure_rate= ((sum(iif(success=="True", 0, 1 ) )+0.00000)/ count()) * 100,
failures=sum(iif(success=="True", 0, 1 ) ),
total=count()
by target, bin(timestamp,1h)
|where Failure_rate > 50

This is the query I am trying to run.

Looking at the first comment, It looks like we were relying on method #2, but seems to be no longer viable.

Daniel, you're absolutely correct in the query being fine. Unfortunately, right now alerts do not yet support cross-Application Insights-Log Analytics alerts. It is something that is on their backlog, but without firm ETAs yet. I've let them know of this discussion, and they'll reply if there's any additional information available. 

 

In this specific case however, the good news is that since you're targeting a single app, Application Insights also supports log-based alerts! Instead of creating this alert targeted at your Log Analytics resource, in the Azure portal open the "Sitecore Production" Application Insights resource, select "Alerts" from the left-hand navigation menu on the AI blade, and under target, select "custom log search". Your query would then look identical, minus using "dependencies" instead of "app(...).dependencies" for your first line.

Hi Evgeny,

Are there any news regarding cross-Application Insights-Log Analytics alerts support? As I can see it does not work yet. Still no ETA for this?