aws / aws/aws-logging-dotnet

Structured variables not shown when Serilog used

Open
#169 13 comments 1 reaction 0 assignees View on GitHub
feature-request module/logging p2 queued
Dominant language
C#
Stars
307
Forks
135
Avg merge
1d 10h
Merged PRs (30d)
4

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();
});
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the Serilog configuration and Program.cs setup shown in the issue, then reproduce a structured log sent through AWSSeriLog and inspect its CloudWatch representation. Compare it with the alternative Serilog.Sinks.AwsCloudWatch behavior and verify that structured variables are preserved while the Microsoft/System filtering remains configurable.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, csharp
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.