The last two releases bring two additional capabilities
- JSON Structured Logging
- Use Apple
containerfor cross compilation
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: Configuring JSON and plain text log formats - AWS Lambda
Support Apple Container on macOS
We added experimental support for cross compilation with Apple container, as a replacement for Docker. On macOS, you can configure the archive plugin to work with container with the new --conatiner-cli command line argument:
swift package --disable-sandbox \
--allow-network-connections docker \
archive \
--container-cli container
A couple of things to note:
dockeris the default. There is no change in existing behaviour.containerCLI uses macOS' XPC to communicate with the container server. This requires to disable the SPM sandbox entirely- Due to a small issue on SPM, you have to specify both
--disable-sandboxand--allow-network-connections docker(specified inPackage.swift). The issue is already fixed but we were too late to land it in Swift 6.3. I hope it will land in a follow up release soon after 6.3.
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 Add support for JSON Structured Logging by sebsto · Pull Request #638 · awslabs/swift-aws-lambda-runtime · GitHub
SemVer Patch
- update dependencies by @sebsto in update dependencies by sebsto · Pull Request #651 · awslabs/swift-aws-lambda-runtime · GitHub
Other Changes
- Update CDK dependencies by @sebsto in Update CDK dependencies by sebsto · Pull Request #650 · awslabs/swift-aws-lambda-runtime · GitHub
- Implement a cache for integration test by @sebsto in https://github.com/awslabs/swift-aws-lambda-runtime/pull/649
Full Changelog: https://github.com/awslabs/swift-aws-lambda-runtime/compare/2.7.0...2.8.0