Open
Description
I get logs to cloudwatch however variables are not recognized inside aws cloudwatch.
This is my configuration:
"serilog": {
"Using": [
"AWS.Logger.SeriLog"
],
"LogGroup": "rimacSD-alecs-api-production",
"IncludeLogLevel": true,
"IncludeCategory": true,
"IncludeNewline": true,
"IncludeException": true,
"IncludeEventId": true,
"IncludeScopes": true,
"Region": "eu-west-1",
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Enrich": [ "FromLogContext", "WithMachineName", "WithEnvironmentUserName", "FromLogContext" ],
"WriteTo": [
{
"Name": "AWSSeriLog",
}
]
},
If I use alternative Serilog.Sinks.AwsCloudWatch then I get variables inside cloudwatch but I can't figure out how to remove logs
from Microsoft and would rather use this official library.
Inide Program.cs I have this:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseSerilog((hostingContext, services, loggerConfiguration) =>
{
_ = loggerConfiguration.ReadFrom.Configuration(hostingContext.Configuration)
.Enrich.WithProperty("Application", hostingContext.HostingEnvironment.ApplicationName)
.Enrich.WithProperty("Environment", hostingContext.HostingEnvironment.EnvironmentName);
})
.ConfigureWebHostDefaults(webBuilder =>
{
_ = webBuilder.UseStartup<Startup>();
});
}