# Lambda: Support for Lambda Structured Logging and Apple container

**URL:** <https://forums.swift.org/t/lambda-support-for-lambda-structured-logging-and-apple-container/84972>\
**Category:** Server\
**Tags:** lambda\
**Created:** [February 25, 2026, 8:03am UTC](https://forums.swift.org/t/lambda-support-for-lambda-structured-logging-and-apple-container/84972 "2026-02-25T08:03:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebsto](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sebsto/32/27165_2.png) [@sebsto](https://forums.swift.org/u/sebsto)\
**Post date:** [February 25, 2026, 8:03am UTC](https://forums.swift.org/t/lambda-support-for-lambda-structured-logging-and-apple-container/84972/1 "2026-02-25T08:03:33Z")

</div>

The last two releases bring two additional capabilities

1. JSON Structured Logging
2. Use Apple `container` for 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:

```json
{
    "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`:

```yaml
      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](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs-logformat.html)

## Support Apple Container on macOS

We added experimental support for cross compilation with [Apple container](https://github.com/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:

```sh
swift package --disable-sandbox \
              --allow-network-connections docker \
              archive \
              --container-cli container

```

A couple of things to note:

1. `docker` is the default. There is no change in existing behaviour.
2. `container` CLI uses macOS' XPC to communicate with the container server. This requires to disable the SPM sandbox entirely
3. Due to [a small issue on SPM](https://github.com/swiftlang/swift-package-manager/issues/9763), you have to specify both `--disable-sandbox ` and `--allow-network-connections docker` (specified in `Package.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](https://github.com/awslabs/swift-aws-lambda-runtime/pull/638)

### SemVer Patch

- update dependencies by @sebsto in [update dependencies by sebsto · Pull Request #651 · awslabs/swift-aws-lambda-runtime · GitHub](https://github.com/awslabs/swift-aws-lambda-runtime/pull/651)

### Other Changes

- Update CDK dependencies by @sebsto in [Update CDK dependencies by sebsto · Pull Request #650 · awslabs/swift-aws-lambda-runtime · GitHub](https://github.com/awslabs/swift-aws-lambda-runtime/pull/650)
- Implement a cache for integration test by @sebsto in [https://github.com/awslabs/swift-aws-lambda-runtime/pull/649](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](https://github.com/awslabs/swift-aws-lambda-runtime/compare/2.7.0...2.8.0)

---

<div class="post-metadata">

**Author:** ![MahdiBM](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/mahdibm/32/45271_2.png) [@MahdiBM](https://forums.swift.org/u/MahdiBM)\
**Post date:** [February 25, 2026, 8:51am UTC](https://forums.swift.org/t/lambda-support-for-lambda-structured-logging-and-apple-container/84972/2 "2026-02-25T08:51:09Z")

</div>

Thank you very much, this is going to make dealing with logs a lot easier.

Not 100% related but also thanks for the [`SSOCredentialProvider`](https://github.com/soto-project/soto-core/pull/686) you recently contributed to Soto. That's also going to make it easier to run our different environments locally by relying on the SSO credentials and not having to switch between AWS accounts manually.

---

<div class="post-metadata">

**Author:** ![sebsto](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sebsto/32/27165_2.png) [@sebsto](https://forums.swift.org/u/sebsto)\
**Post date:** [February 25, 2026, 9:05am UTC](https://forums.swift.org/t/lambda-support-for-lambda-structured-logging-and-apple-container/84972/3 "2026-02-25T09:05:54Z")

</div>

Thank you for the message!

Indeed, I contributed to add a `LoginCredentialProvider` and `SSOCredentialProvider` on Soto-Core.

This allows Swift applications to pickup credentials and to refresh them on machines configured with AWS Identity Center (`aws sso login`) or where you use the new `aws login` CLI to acquire temporary credentials based on your web session.

I use these in my command line tools

> **[GitHub - sebsto/xcodeinstall: A command line tool to download and install...](https://github.com/sebsto/xcodeinstall)**
>
> A command line tool to download and install Apple's Xcode

> **[GitHub - sebsto/anthropic-proxy](https://github.com/sebsto/anthropic-proxy)**
>
> Contribute to sebsto/anthropic-proxy development by creating an account on GitHub.
