Closed
Description
Expected Behaviour
When the logs are written to CloudWatch, the logging level is only applied at the structured logging. The CloudWatch logs have a different log level.
For example, when log level is set to "Error" with PowerTools, the CloudWatch log remains at "info". This is the same for all logging levels.
The issue here is that when our logs are ingested by company-wide logging aggregator (DataDog), the logs now are tagged with both "Error" and "info".
Is there a way to coerce the CloudWatch logging level to align with the PowerTools logging level?
Current Behaviour
2025-02-24T13:36:06.483Z f6e6096f-5d28-57bd-99a3-6959252efdd6 info
{
"cold_start": false,
"xray_trace_id": "1-67bc<snip>",
"function_name": "<snip>",
"function_version": "$LATEST",
"function_memory_size": 350,
"function_arn": "arn:aws:lambda:us-east-2:<snip>",
"function_request_id": "f6e6096f-<snip>",
"timestamp": "2025-02-24T13:36:06.4837199Z",
"level": "Error",
"service": "<snip>",
"name": "AWS.Lambda.Powertools.Logging.Logger",
"message": "<snip>"
}
Code snippet
Use any standard logging message.
Possible Solution
No response
Steps to Reproduce
Log an event as an "Error". Json output is correctly set at "Error". CloudWatch is set at "info".
Powertools for AWS Lambda (.NET) version
latest
AWS Lambda function runtime
dotnet8
Debugging logs
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
👀 In review