Hi, everyone.
My name is Jason Freeberg.
I'm a Product Manager on Azure App Service.
And in this video, let's talk about monitoring
and logging for your applications
on Azure.
And let's start by talking about Azure Monitor.
Now, if you're not familiar,
Azure Monitor is the central sync for all of your logs
and metrics on Azure, and not just for App Service.
You can see in this diagram that you can send logs
and metrics from your application, from the operating system
and the Azure Resources themselves into Azure Monitor.
From there, you can query and analyze
those results with Power BI and log analytics.
You can also set up
alerts based on those queries and get text messages and emails.
And then you can also set up auto scaling rules using Azure Monitor.
So in that previous video, when we were setting up
auto scale rules for App Service, under the hood,
a lot of that infrastructure runs on top of Azure Monitor.
So to get started with Azure Monitor,
let's go back to our Web App.
And then down here on the left hand
side, we'll go into diagnostic settings
and this tab is where we set up our integration with Azure Monitor.
So you can see here, I already have a diagnostic setting
configured called App Service Logs
and if I click 'edit setting', you can see
that I've selected to capture a few different log categories here.
There's the App Service Antivirus Scan logs, HTTP logs
and console logs that are written by my application to the console.
And then there's a few other log types selected here.
And then I'm routing those logs
to a log analytics workspace, which we'll see in a minute.
But I can also send those logs to a storage account to archive them there.
I can stream them to an event hub,
and then I can also send them to a partner solution like Data Dog.
So now that we have a diagnostic setting configured,
let's go back to the Web App blade and we'll click on 'Logs'
and this tab will bring us to a log analytics workspace.
You can see here on the left hand side, I have a few of those
log types that I selected in the diagnostic setting.
And we can write a quick query here
for App Service console logs and we'll just take the last 100 logs
So here we can see this is all the logs
that are written to the console of our Web App.
So here, this is showing the startup
logging from the App Service container.
It's extracting our node modules here.
And if we keep going,
we can see that the node application is starting up
roughly about here and now we're seeing the express logs.
And then I can also filter this down.
I can add a condition where result description contains
the string 'error'.
And if I run this
you can see here that we're only getting results back
that contain the string error.
So based off this query, I can share it with my team.
I can also copy the results and send them.
And then I can also set up an alert and get a text message or an email.
Whenever this query reaches a threshold
Now, the other thing I want to call out is Application Insights.
So if we scroll back up here
on the left, Application Insights is the Azure-native
application performance monitoring software for Azure.
You can enable this on App Service without any code changes.
And under the hood, App
Service will attach the monitoring agent to your application.
And you can see here, I already have App Insight set up.
So I'll click on 'View Application Insights data'.
And then, in here,
we're looking at Application Insights for this resource.
And if I click on 'live metrics',
this will open a view of live metrics for my Web App,
such as the request count, CPU and memory utilization.
And if I pop over to the Web App over here in this tab,
I'll refresh this to send a few requests
and then if we come
back over into live metrics, you can see here that the memory is
starting to spike as those requests come in and the request rate
will pick up here in just a minute.
You can also go into the performance tab
and you can drill into the different API calls for your application.
So you can see here, this is the GET requests
for one of the edit pages for our rentals app.
And then you can go into samples for this
and inspect the dependency calls for that transaction.
So that was a brief overview of the different logging
and monitoring solutions for Azure App Service.
I hope you enjoyed the video and thanks for watching!