.NET 6 webapi deployed to Azure App Service, logging to AWS Cloudwatch does not work.

Pete Franklin 1 Reputation point
2022-10-19T22:08:45.41+00:00

I've got a .NET 6 webapi hosted in an Azure AppService. I am using AWS.Logger.AspNetCore to log to AWS Cloudwatch. It is working when I run locally, 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 so:

builder.Logging.AddAWSProvider();  

  
// Get AWS configuration  
var awsOptions = builder.Configuration.GetSection(AWSOptions.SectionName).Get
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,861 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,366 Reputation points
    2022-10-20T16:34:33.383+00:00

    check your AWS firewall rules

    0 comments No comments

  2. Takahito Iwasa 4,841 Reputation points MVP
    2022-10-24T21:50:21.133+00:00

    Hi, @Pete Franklin

    You're specifying an IAM user access key and secret, are they the same as localhost?
    I recommend checking the IAM policy first.

    Permission

    The simplest possible cause is that he does not have the following permissions granted to his IAM user.

       logs: CreateLogGroup  
       logs: CreateLogStream  
       logs: PutLogEvents  
       logs: DescribeLogGroups  
    

    https://github.com/aws/aws-logging-dotnet#aspnet-core-logging

    Deny Condition

    If the above permission is granted, does her IAM policy restrict her IP address or anything else?

    https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_examples_aws_deny-ip.html


  3. Alex Hales 0 Reputation points
    2023-11-24T14:16:12.6633333+00:00

    Hi there,

    I faced a similar issue recently with my .NET 6 webapi on Azure AppService and AWS Logger. It can be quite frustrating when logs don't appear where you expect them to.

    In your case, have you checked the Cloudwatch configuration and permissions in your Azure AppService environment? Sometimes, issues like this can be related to access permissions or network configurations.

    By the way, if you're interested in improving your English language skills, you might find some helpful resources on "Ways to Say" at Microsoft's English Language Learning Center.

    Hope this helps!

    0 comments No comments