What is the difference between Application vs Site Diagnostics on Azure Websites? - azure

what's the difference between these two, please?
NOTE: I'm not talking about the storage medium (I know the diff between FS/TS/BS, etc).

site diagnostics is your typical web server logging (e.g., failed request tracing, http errors, etc...)
application diagnostics are the one's produced by the web app itself, i.e, Trace info, etc...

Related

Azure diagnotics settings (preview)

Im new to Azure. I have an App service that has Application Insight enabled. Im trying now to understand what Diagnotics Settings is and what it can be used for.
It seems like most of what Diagnotics Settings does can be done through Application Insights.
Is this correct or am I misunderstanding the purpose behind Diagnotics Settings?
There are some (major) differences. From the docs:
Platform logs in Azure, including the Azure Activity log and resource logs, provide detailed diagnostic and auditing information for Azure resources and the Azure platform they depend on. Platform metrics are collected by default and typically stored in the Azure Monitor metrics database.
Now, when we are talking about auditing information and activity logs, that is something that Application Insights (AI) cannot do. Also, AI is geared towards applications whereas Diagnostics Settings is used to emit information about azure platform resources. AI allows you to send custom telemetry and also can track a lot more detailed information.
I assume you ask this question in the context of an Azure Web App or Azure Function. I'd recommend to enable both. AI has a lot more to offer than Diagnostics Settings when it comes to detailed information about how your application is behaving.

Azure web app (nodejs) logs don't appear in blob storage but webjob logs do

I configured Azure Web App Application Logging (Diagnostics logs).
https://learn.microsoft.com/en-us/azure/app-service/web-sites-enable-diagnostic-log
I have a nodejs backend api (express) and a couple of webjobs hosted on the same webapp.
I use console.info/console.error in the code for logging.
In the logstream/console in the portal I can see that logs coming from the webjobs are formatted with date, pid, level, ... but logs coming from the actual application are not formated.
Example of 2 console.info. First is from the api and 2nd from one webjob :
Start handling command DeleteCustomerCommand
2018-01-12T17:02:16 PID[9484] Information CustomerDeletedEvent handled
The problem is that in the blob storage, only the logs coming from webjobs are stored. I suppose this format is a requirement from Azure.
Do you know why the console.info behaves differently ? Can I do something to have the same behavior in the api ?
Do you know why the console.info behaves differently?
Azure WebJobs and Azure Web Apps actually run in the different context. WebJobs is hosted on the Kudu SCM site, and it is executed by Kudu API that captures the script log and formats it for you; while Web Apps is hosted on Microsoft IIS, and there's nothing built into the iisnode module to do this.
Can I do something to have the same behavior in the api?
You'll need to look into other modules to provide a richer formatting experience. For example: winston. Also, there is an Azure blob storage transport for winston.

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

Azure Website - Web API Swallowing Errors

I have a asp.net web api application deployed as an azure web app. One of the endpoints occasionally throws an exception. Normally this isn't an issue for us. We have an ExceptionLogger attached to the api services. This has been in place for sometime and normally works fine.
Currently we see that a 500 response comes back from the server, but nothing is logged. I have tried setting GlobalConfiguration.Configuration.IncludeErrorDetailPolicy to IncludeErrorDetailPolicy.Always, but the response always comes back with no body content.
What else can I do to track the source of the problem?
If you have a consistent repro, then you can use remote debugging to attach to your web app and debug it (https://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-troubleshoot-visual-studio/).
Failing that, you can enable better diagnostic logs using the web app settings. Information on how to do so is here:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-configure/ under the section "Enabling diagnostic logs".
In your case you should have application logging enabled, and perhaps failed request tracing would be useful (FREB).
For even more tools you can use the Support Site Extension (http://azure.microsoft.com/blog/2014/12/01/new-updates-to-support-site-extension-for-azure-websites/) which would allow you to look at live event logs and HTTP traffic. For a deeper dive into debugging in Azure App Service see: https://channel9.msdn.com/Events/Ignite/2015/BRK4704.

how to diagnose azure problems

I've recently starting experimenting with azure cloud hosting and my web app had about 10 minutes down time today.
I'm not sure why and I was wondering what tools I have available for determining the cause of the downtime.
You have application logs and site logs. Basically application logs are information produced by your web app code. You can use instrumentation to trace call and exceptions in your appliction. Site logs are information produced by the web server and you can see error messages and failed request tracing without instrumenting your code. You won't have relevant information now since by default all diagnostics are turned off but if it happens again you know where to look for.
Here's how to enable and visualize this information.
Enable diagnostics logging for web apps in Azure App Service
https://azure.microsoft.com/en-us/documentation/articles/web-sites-enable-diagnostic-log/

Resources