Dashboards on custom application using application insights - azure

We have a lot of applications that throws custom logs to application insights. I would like to make a dashboard where I can see if each application is running or throwing exceptions etc. I have tried looking around in log analytics and it does not seem to have a connector to Application insights. Can anyone provide with some information to start on? Should I use Monitor, Log Analytics or Sentinel for this task and how do you get started with custom application insights logs.

Application Insights is part of Azure Monitor. When creating a new App Insights resource you can now choose to store everything in an Azure Log Analytics Workspace, see the docs. Or you can migrate your existing resource to a workspace backed resource.
Then you can use workbooks to visualize data using interactive workbooks. These workbooks are also available to classic App Insights resources however.
There is also the possibilty to query an App Insights resource in any Log Analytics Workspace by using the app expression like this:
app("name-of-your-ai-resource").requests
| order by timestamp desc
| project timestamp, url, resultCode
and use those results for visualizations.
Finally you can also use the rich capabilities of Power Bi to create interactive reposts, see the docs

Related

Application Insights return empty charts on Grafana

I'm trying to display azure application insights on a grafana dashboard, the application insights are enabled for a web service on the Azure ML studio but end up with empty charts for all the available metrics. Can you please tell me where I'm doing it wrong or if I'm missing something? Thank you.
Application Insights is an Application Performance Management service from Azure for web developers on multiple platforms and it can be used to monitor your web application. You would get the charts in Grafana if you are following steps mentioned below.
In Grafana, use the Azure Monitor Data Source plugin which supports Azure Monitor, Azure Log Analytics and Application Insights metrics. But remember this plugin requires Grafana 4.5.0 or newer for Application Insights. You can install the plugin in after updating your Grafana in CLI with the following command.
grafana-cli plugins install grafana-azure-monitor-datasource
You can also set up Grafana on Azure through the Azure Marketplace.
The plugin can access metrics from both the Azure Monitor service and the Application Insights API. But you would need to configure access to the services. If you are using Application Insights, then you need two pieces of information from the Azure Portal which are the Application ID and an API key. Check this Application Insights API QuickStart for more information.
Write analytic queries for the Application Insights. When you set service type to "Application Insights", the menu icon to the right adds another option, "Toggle Edit Mode". Once clicked, it gives you a full text area in which to write log analytics queries. Check this Writing Analytics Queries For Application Insights section of the Grafana document for more information.
The above mentioned procedure will help you get the proper charts in the Grafana. I would also suggest to read this Monitor your Azure services in Grafana document from Microsoft for more information.

Error setting up Azure Function within Azure Resource under Log Analytics Workspace

I have error setting up Azure Function within Azure Resource under Log Analytics Workspace.
When only AllMetrics is checked, it works. But whenever FunctionExecutionLogs is checked, error occurs like below:
1.Nav to your log analytics workspace in azure portal.
2.in the left blade, select Workspace Data Sources -> Azure Resources, then click your azure function there.
Check FunctionExecutionLogs and error occurs.
Any idea?
Setup data used by Azure Log Analytics with Azure Fucntions
Update
We would like to understand more on Application InSights and Log Analytics, and use the best tool for us.
'FunctionExecutionLogs' for azure function/web app in azure log analytics will not be supported any more.
So application insights is a better choice for monitoring azure function.
The following is the feedback from MS log analytics team:
Several months ago, App Service/Functions team on-boarded to Azure Monitor diagnostic logs but they don't actually emit log data.
Basically there are thousands of diagnostic setting registrations which are no-ops and don't actually do anything.
Recently in the past few weeks, we've been in discussion with App Service to release this feature in the next few weeks as a private preview feature.
This unfortunately is a breaking change as only private preview customers can turn on diagnostic logs for App Service.
Please note -- There is no actual customer impact as whatever customers turned on previously never worked to begin with.
To fix the deployment script, we should ask customers to update their template to only turn on metric export and not logs --- this won't have any actual customer impact.
So, from our Log Analytics side, this is a scenario we are not support from our Log Analytics team which has declared by our Production Group any more.
I would recommend using Application insight with Azure Functions. Application insights has deeper integration with Azure Functions and is the recommended way of setting up Analytics for your app. Is there a specific reason you want to setup through Log Analytics instead of Application Insights?
Now, almost 2 years later, Classic Application Insights is deprecated (apparently it will be retired around Feb '24). The recommended way to set this up is to
Create a log analytics workspace
Create an application insights resource that has it's workspace id set to the LA workspace created in the previous step
Your functions will still be configured to log to app insights but that has its datastorage now backed by the LA workspace instead of bringing its own.
You can migrate existing app insights to link to a LA workspace - apparently this migration is not reversible but it should be transparent from your function point of view (i.e. the app insights connection doesn't change). Details can be found here: https://learn.microsoft.com/en-nz/azure/azure-monitor/app/convert-classic-resource

Azure application insights or log analytics

What is the use case for Azure application insights or log analytics?
I am using APIM and Azure Functions and want to perform logging for requests. Which one is the best fit, application insights or log analytics?
https://learn.microsoft.com/en-gb/azure/azure-monitor/overview
Update
In particular, any info on Azure application insights vs log analytics used for APIM?
What used to be known as Application Insights and Log Analytics independent offerings - are now a part of Azure Monitor. We're actively merging both platforms.
For instance, Analytics exploration part is exactly the same (same backend, same UX, same capabilities, just different data schema). Alerts are the same. Some experiences are still different (for instance, app experiences such as Application Map).
Example: in Azure Monitor Overview (https://learn.microsoft.com/en-gb/azure/azure-monitor/overview):
"Log Analytics" is referred as a feature and not what used to be known as Log Analytics as a product. For instance, Application Insights resources provide the same "Log Analytics" feature.
For Azure Functions / APIM the native integration with Azure Monitor is through Application Insights.
Update (October, 2020). Application Insights can now store data in Log Analytics workspaces. Now many workspace related features are available to Application Insights resources. How to migrate.
Azure function better to go with application insights and if you working with kubernetes cluster choose Log analytics work space
Azure Functions offers built-in integration with Azure Application Insights to monitor functions.
So for azure function, you'd better use application insights, which is easy configure.
Details are here.
Application Insights
Application Insights is an Application Performance Management (APM) service, that you use to monitor your application. It helps to detect performance anomalies, has analytic abilities, and can help you understand how users interact with your application.
Not only can it collect telemetry data from your application, but it can also collect information from the application host, Azure Diagnostics, or Docker logs. It’s also nice that you can use Application Insights to set up tests that send requests to your website/service to check for availability (and receive a notice if these fail).
One of the most powerful things that I’ve noticed in my use of Application Insights (which is monitoring this blog), is the Smart Detection feature. This feature proactively analyzes and detects changes in your application. So even if you hadn’t set up an Alert of monitoring of a specific metric, it can pick it up and react to it.

Azure Log Analytics configured for Application Insights showing performing assessment for very long

I am trying to load the logs from Application Insights to OMS in Microsoft Azure. The issue is arising when I am trying to get this data using Application Insights connector and the OMS portal shows me Performing Assessment continuously. Is it normal it already 1 day since this is shown? And Its a demo application which have very less logs.
The root cause maybe due to the Application Insights connector management solution is no longer required and will be deprecated. Starting July, you will not be able to link new Application Insights resources to Log Analytics workspaces.
Please refer to here.
And OMS is moving to Azure, you can use the new portal as described here.

Run Azure Log Analytics query against Application Insights instances

I'm using the Azure Log Analytics .NET SDK to execute queries.
The NuGet package I'm using for this SDK is Microsoft.Azure.OperationalInsights.
Querying against a normal Workspace is fine.
Now I want to query against an Application Insights resource, like you can do in the portal via the 'Analytics' button on an Application Insights blade. For this I need a WorkspaceId, that I cannot find on the resource.
Is there a way to run these queries via the OperationalInsights SDK or do I need to create my own wrapper around the Application Insights API? That seems to add extra authentication via the token, which I'd rather not need (I already have access to Log Analytics).
Found out that you can query across workspaces and even across apps.
For apps, use app(appName) like so:
app('AppInsightsName').requests
For a different workspace, use this:
workspace("workspaceId").request

Resources