Skip to content

2.8.0

Latest

Choose a tag to compare

@sebsto sebsto released this 25 Feb 08:01
· 7 commits to main since this release
553b5e3

This releases adds support for JSON Structured Logging

JSON structured logging lets CloudWatch capture your Lambda logs as searchable key-value pairs instead of plain text, making it significantly easier to filter, query, and debug in production. It also enables you to attach metadata and contextual information (like request IDs or error codes) to each log entry, which is essential for automated analysis at scale. This is especially relevant since Lambda Managed Instances only support JSON log format — so this release brings the Swift runtime in line with that requirement.

Example of log entry:

{
    "message": "Server started and listening",
    "requestId": "N\/A",
    "level": "INFO",
    "timestamp": "2026-02-24T18:43:11.688Z",
    "metadata": {
        "port": "7000",
        "host": "\"127.0.0.1\""
    },
    "traceId": "N\/A",
    "file": "AWSLambdaRuntime\/Lambda+LocalServer.swift",
    "function": "withLocalServer(host:port:invocationEndpoint:eventLoopGroup:logger:_:)",
    "line": 168
}

There is nothing to change in your code to activate JSON Structured logging, this is a configuration at the function level either in the console, your IaC code, or the CLI when you create or update a function. Behind the scene, the Lambda service sets AWS_LAMBDA_LOG_FORMAT=JSON. Similarly, you can control the log level directly from the console or your IaC code.

We added an example in Examples/JSONLogging:

      LoggingConfig:
        LogFormat: JSON
        ApplicationLogLevel: DEBUG
        SystemLogLevel: INFO

The old behaviour of text-based logging and verbosity control through the LOG_LEVEL environment variable is preserved. This is a purely additive change.

Learn more about Lambda Structured Logging in the doc: https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs-logformat.html

Acknowledgements

I'd like to thank @manojmahapatra and @benrosen78 for their contributions on these two new capabilities.

What's Changed

SemVer Minor

  • Add support for JSON Structured Logging by @sebsto in #638

SemVer Patch

Other Changes

Full Changelog: 2.7.0...2.8.0