Logging to AWS Cloudwatch from ASP.NET Core 6 Web API hosted in Azure AppService - azure-web-app-service

I've got an ASP.NET Core 6 Web API hosted in an Azure AppService. I haven't been satisfied with any of the logging options in Azure, so I am trying to use AWS.Logger.AspNetCore to log to AWS Cloudwatch.
When I run locally, I can see the messages in Cloudwatch. But when I run in the deployed Azure AppService environment, I don't see any of the log messages in Cloudwatch.
In Program.cs, I configure logging like this:
builder.Logging.AddAWSProvider();
// Get AWS configuration
var awsOptions = builder.Configuration.GetSection(AWSOptions.SectionName).Get<AWSOptions>();
// Set environment variables for AWS SDK uses for accessing services
Environment.SetEnvironmentVariable("AWS_ACCESS_KEY_ID", awsOptions.AwsAccessKeyId);
Environment.SetEnvironmentVariable("AWS_SECRET_ACCESS_KEY", awsOptions.AwsSecretKey);
Environment.SetEnvironmentVariable("AWS_REGION", awsOptions.Region);
I know that the AWS key configuration is loading correctly because I am also using them for other AWS services, like Cognito and it is working.
Any idea why the logs wouldn't be showing up when running in Azure AppService, but they do when running locally?

Related

Azure Web Jobs unable to read configuration of Azure App Service

I am currently deploying a C# console app as a Continuous Azure Web Job to an Azure App Service and I am using the Azure Web Jobs SDK 3.X(https://learn.microsoft.com/en-us/azure/app-service/webjobs-sdk-how-to).
The Web Job successfully deploys to the Azure App Service but the status of the Web Job is "Pending Restart". When I check the logs, the error I see is that a configuration value is being read in as NULL. I am setting this value in the App Service's configuration/Application Settings page but it seems my Web Job is unable to read it. Do these settings need to be set during deploy? Or do I need to be setting these configuration values in a different location?
My issue was that my app thought that my environment was Develop and it was looking for the appsettings.Development.json file. Once I corrected that issue, it looks like I am reading in my app settings correctly.

Is there any way of Accessing/ fetch application logs of AKS (Azure kubernetes Services) from outside or browser?

I have deployed a web application on Azure Kubernetes Service (AKS). I want to generate Application logs of deployed web application of cluster like Log folder. I want to access those logs from LOG folder through browser or any other solution which I can easily share with developers to access logs from their system as well.
You can use the logging options, cloud-native solutions like fluentD and you can push the logs from LOG folder to Elasticsearch or Azure logging solution and you can watch the logs into dashboard.
Fluentd : https://www.fluentd.org/
Check out more at : https://logz.io/blog/kubernetes-log-analysis/

Unable to see application console logs in azure log stream, filesystem , blob storage

We are using spring boot app deployed in azure app service , App is using Logback by default and logging in console. Even though i have configured the storageV2 account to retreive the logs in blob storage , enabled to store logs in filesystem still i am not able to see the logs at any place. Is there any further configuration needed to be added in java app to get the logs ? Though i am getting web server related logs (url getting hit) but
app logs are not showing up.

Nodejs on Azure where is output of the console log

I deployed a nodejs web app on azure as an
App Service
How do i see the console.log from my application?
You can tail the log with the Azure CLI...
$ az webapp log tail --name <name of webapp> --resource-group <name of resource group>
More info here
I just followed Enable diagnostics logging to enable Application Logging (Filesystem), Application Logging (Blob) and found console.log and console.error would output logs under D:\home\LogFiles\Application\, you could use KUDU to view your log files or you could also access https://{your-app-name}.scm.azurewebsites.net/api/vfs/LogFiles/Application/index.html and check the stdout and stderr type as follows:
Moreover, as Azure Web App (Website) Logging - Tips and Tools mentioned about application logs for node.js as follows:
Setting application logs in the Azure portal
For node.js websites the way to write application logs is by writing to the console using console.log('message') and console.error('message') which goes to Information/Error level log entries. Currently the only supported target for the log files for node.js is the file system.
Other web site types like php and python are not supported for the application logs feature.
For logging into blob, you may leverage winston-azure-blob-transport for collecting the application logs from your Node.js web app into Azure Blob Storage.
You can open a Log Stream using the azure portal.

How to see uploaded file on cloud service of azure?

I have successfully deployed my service to the azure cloud services and its working great. But I am having one problem, I have a logging layer in my service which logs activities and error to the log files. But now when I have deployed my service to azure cloud services I am unable to access the log files, since I made the package file for deploying it to azure. Can somebody tell me how to access those logs file.
Windows Azure Diagnostics - http://msdn.microsoft.com/en-us/library/windowsazure/gg433048.aspx.
There is also a couple short 5 minute videos that shows how to set it up and use it - http://channel9.msdn.com/Series/DIY-Windows-Azure-Troubleshooting/Enabling-WAD and http://channel9.msdn.com/Series/DIY-Windows-Azure-Troubleshooting/WAD-Intro.

Resources