Skip to content

Support for AWS JSON log level format #807

@artkhod

Description

@artkhod

According to https://docs.datadoghq.com/logs/guide/logs-show-info-status-for-warnings-or-errors/ we can remap status from let's say "level" or include status attribute ourselves.

status: status.unwrap_or("info".to_string()),

However, since it's a lambda extension, it would make sense to support AWS JSON Log format

{
  "timestamp": "2025-08-27T10:25:22.244Z",
  "level": "WARN", <--- level is uppercase, and it drives the log level setting on the lambda configuration itself
  "message": "AWS Lambda plans to remove support for callback-based function handlers starting with Node.js 24. You will need to update this function to use an async handler to use Node.js 24 or later. For more information and to provide feedback on this change, see https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/issues/137. To disable this warning, set the AWS_LAMBDA_NODEJS_DISABLE_CALLBACK_WARNING environment variable."
}

Here's the list of levels https://github.com/aws-powertools/powertools-lambda-typescript/blob/801333deff04b09d4adb88860c60f497295685d9/packages/logger/src/constants.ts#L17

JSON log format can be set here

Image

and it's described by this section https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs-logformat.html#monitoring-cloudwatchlogs-JSON-application

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestgood first issueGood for newcomersversion/nextIssues related to DD_EXTENSION_VERSION: next

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions