Azure Linux App Service Not Displaying Application Logs - linux

I've set up a linux based azure app service and am unable to see log messages from the application itself in both the "log stream" and "logs" tab of the monitoring options. It is important to note I can see start up messages in the logs for the deployed application and can see outputs when get and post requests are made to the corresponding connection url so i know its running (Also the tasks the application is written to perform are carried out). Additionally, in the "App Service Logs" tab I have "Application Logging" set to "File System" as is standard for what I'm trying to output but this hasn't resulted in any in-application logs being visible.
Lastly about a year ago I managed to set up two other linux based azure app services that work completely as desired and output the in app log messages to the stream and cannot replicate this behaviour with this one. I feel there is just some setting or property somewhere i have overlooked but no matter how many different setting tabs I investigate I cannot spot any significant differences.
Are there any somewhat hidden options or requirements to be aware of in order to get in-application logs to be outputted to a linux based app services "log stream"? Or some other solution at a higher level in the azure resource group, workspace, application insights etc that may solve this issue? Any help and suggestions are greatly appreciated thank you.

I have tested in my environment.
Go to Your App Service --> Select Diagnose and Solve Problems --> Click on Availability and Performance --> Select Application Logs
You should be able to see the Application Logs, Platform Logs and Deployment Logs here.
Log Stream gives you the live logs of your application. The logs displayed in the Application logs should be seen in the Log Stream.

Related

Azure App Service File And Configuration Change Monitoring

As part of our production environment we have several App Services running inside of Azure. I would like to implement notifications to be sent to a specific email address upon file or configuration changes within those App Services. I have tried enabling Application Changes for the service but it does not appear to provide the capability to set up alerts on the changes,
I have also tried enabling App Service alerts but it does not appear that any of the test configuration changes that I have made were captured by the signal "Apply Web App Configuration".
The last thing that I tried was to enable Diagnostic Settings to capture AppServicePlatformLogs and AppServiceFileAuditLogs and stream them to an Event Hub, however, I cannot determine how to set up the email notification from the hub for the events.
I am hoping that there may be an easier way to set this up and was hoping that someone may have some pointers or resources that I can follow.
I was able to accomplish this under "Monitoring" -> "Alerts". A more detailed walkthrough can be found here https://perituza.com/blog/azure-app-service-monitoring-and-alerts/. The key was selecting "Activity Log - Administrative" as the Monitor Service in the Condition.

Logging from an azure console app as a web job

I am in search for a good way to log various messages while being able to use functions, logic, monitoring, etc to get notified or run a certain task to fix a problem and notify someone.
What I have in mind is something like "If a specific error happens send me a notification or restart a service"
What I currently already have is an app service that holds 10 web jobs(continuous, triggered). Two of them use the Azure Web job SDK and the rest of them are plain .net core console apps. All of them generate structured logs using serilog and are saved to blob storage.
Is there something I am missing? I don't want to reinvent the wheel here.
You can use application insights with webjobs, more details are here.
You can also set an alert in application insights if error occurs, refer to this doc.
Any more questions please let me know.

Enable the AI using Application Insights Status Monitor but SQL Dependencies in Command property is not showing the generated SQL

I was hosted my ASP.NET web application into local IIS server, then enable the Application Insights by using Application Insights Status Monitor by following this link.
After configuration done, then I went to azure portal and open my application insights resource for seeing the dependency calls, requests, and exceptions everything coming nicely. The problem is that SQL Dependencies in Command property is not showing the generated SQL.
I can only see <server_name> | <database_name>, whereas in the other app I can see the whole query. See the below image for more information about my issue.
But After some time, I received the notification in status monitor like this below figure.
Can you please tell how to resolve the above issue as soon as possible?

AzureWebApp: Monitor Application Logs

I'm building an Azure web-app and if there are certain unexpected errors, I want to be able to bubble it up in the Azure Dashboard / add alerts.
Any System.Diagnostics.Trace.TraceError() messages are logged to the ApplicationLog. Is there a way to add alert/monitoring-graphs for these in Azure Portal?
I think and most flexible option for configuring alerts on Web Apps is enabling the Application insights have the App Insight be one of your event sources:
https://azure.microsoft.com/en-us/documentation/articles/app-insights-search-diagnostic-logs/
Once you have the Application Insight setup then you can easily set any kind of alerts based on the diagnostics that are collected:
https://azure.microsoft.com/en-gb/documentation/articles/app-insights-alerts/
Aram's links below really helps. Please read them.
To Get this working:
Add the ApplicationInsights to your project.
(Optional) If you want log traces (System.Diagnostics.Trace) to be searchable on insights, add Microsoft.ApplicationInsights.TraceListener nuget to your project.
Use telemetryClient.TrackException() to place a server exception
when you hit a critical error.
Add an alert on Azure portal to check for ServerExceptions within the given time window.

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