Deeper analytics for Azure Static Web Apps? - azure

Is it possible to access analytics such as browser, dates and times of site hits, IP addresses, etc.?
From the docs here, it looks like Azure App Insights are only available for Static Web Apps that use Azure Functions. I just have a static website, no API's.
Here is the message I'm shown when trying to enable App Insights:
Ideally, I want to set a Diagnostic Setting and use Azure Log Analytics to view analytics.
How can I get deeper analytics on a Static Web App without a Function API?
EDIT 1: I'd like to at least capture the number of hits somewhere.
Azure Metrics is grabbing them, but doesn't seem to expose logs anywhere, only these visualizations.

Ended up going with:
A stand-alone Application Insights instance
Azure Static Apps does not allow App Insights to be turned on for the resource unless there is an Azure Function involved(?)
Added this App Insights Javascript snippet to each page of the static site.
Got some great help from #MSNEV!
This is the solution I was looking for.

Related

How to view errors for WebApp in Azure portal and what configuration it is required

I am working on the ASP.Net MVC 4.8 application. It does have Logs file log4net and it was deployed in on-premises. Now it has been migrated to Azure. Now I am trying to find out some errors and other logs information however I am not able to find where to go and look for the logfile. I have two interest, 1 check the error messages and any log information.
If I need to make some changes what would be the easiest and straightforward way to capture logs and view them in Azure portal. As you can see in the picture below unter Monitoring there are many ways are given to see the logs but I am not sure where to go.
The app service will create an application insights of the same name.
This application Insights will contain all the logs regarding the web app along with performance data and other telemetry data too.
You can view logs live under live metrics tab in application insights of the same name as web app .
Here I have deployed a simple mvc app which logs using Ilogger (typical boilerplate app which visual studio provides ) . IT will log once I refresh the page.
Refer these MS DOCS on application insights

App Insights is only applicable to Static Web Apps with at least one function

I have the followings TWO independent projects deployed at Azure from GitHub:
an Angular UI project as Static Web App (SWA)
an Node API project as Azure Function (AF)
AF can talk to local-run UI and Postman no problem.
When UI is deployed to Azure and talk to the same AF, it gets 405. To troubleshoot, I did
Query AF logs: FunctionAppLogs | where Level contains "error" returns zero record. FunctionAppLogs | order by TimeGenerated desc | limit 100 returns all Information for Level.
Thinking to get SWA's IP to AF's firewall rule, but it doesn't have networking tab for an IP.
When trying to enable Application Insights for SWA log, it says SWA must have at least one function
I followed this to deploy my Angular SWA. Only difference is his API AF are integrated into the project, mine is a independent project outside of the Angular.
Update, this is how I setup the SWA:
Add a Static Web App
Choose GitHub for publish source, and log in
Choose repository and branch
Complete a new Pull and Merge, project is auto-build and deployed
According to this document, you can enable Azure App Insights for Static Web Apps that use Azure Functions.
Firstly, to enable Application Insights we need an Application Insights resource.
Copy the instrumentation key for the SWA that you want your JavaScript telemetry to be sent. The same need to be added to the instrumentationKey or connectionString setting of the Application Insights JavaScript SDK.
You can add the Application Insights JavaScript SDK to your resource following one of the following two options:
npm Setup
JavaScript Snippet
Here is a sample project that you can refer to and for remote debugging you can check this document
REFERENCES:
Deeper analytics for Azure Static Web Apps
Add an API to Azure Static Web Apps with Azure Functions | Microsoft Docs
Study shows Static Web App (SWA) have integrated API when needs one, and this MS Doc has a Note SWA must have an API to use App Insights.
Another reason SWA must have an Azure Function is because it's backend running at AZ.

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.

View Requests in applications Insights

I have a web api project deployed on azure... I need to see all requests arrive to the APIs.
I am almost sure that before I could see the requests but now I do not see anything... The strange thing is that now applications insights look like switched off... Here what I see when I go on azure:
So, when I go in Analytics on Applications Isights on Azure and I try to do a query on the requests table no result is found.
App. Insights is enabled:
And the instrument key is the same on azure and on my vs project:
What could be happened? Thank you

Monitoring the Azure app services

I was wondering if someone can shed some lights on the application monitoring and alerting solution that's being used to specifically monitor the Azure app service. We have multiple API apps running on App service service and we would like to monitor certain metrics (ex: Availability, response time, number of request received, etc). I enabled the application insight on each of these apps and the result is quite promising, it fulfills all my requirement, but there's one small issue: I need to scroll through each app to see their performance. I can't aggregate them all in one space. I would like to create a centralized dashboard for all aforementioned metrics and have them displayed. I tried using OMS but it seems to be lacking a lot of functionality.
Any pointer would be very appreciated.
I wrote recently about it on our blog: http://predica.pl/blog/azure-monitoring-and-auditing/ - you will find link to MS documentation also there.
If you are using App Insights already you should be able to pick things from App Insights and put it on the Azure portal dashboard. Other than that probably getting data into Power Bi application insight is your best shot - https://powerbi.microsoft.com/en-us/documentation/powerbi-content-pack-application-insights/

Resources