How to configure a Serilog sink for logging to CloudWatch

Question:

I would appreciate some guidance in setting up a Serilog sink for AWS CloudWatch with .NET Core.
I’m using appsettings.json for configuration but I am unable to put the settings in the logger. When trying to write log information to CloudWatch this error appears:

My code is as follows:

In Startup.cs:

My appsettings.json:

Credentials for AWS from my developer machine are set by using environment variables:

Answer:

Just in case anyone has the same problem, this appsettings.json solved it:

Leave a Reply