# AppSyncLogConfig

Logging configuration for AppSync.

- Source: [`aws-appsync/lib/appsync-common.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-appsync/lib/appsync-common.ts#L105)
- Type last changed: v2.224.0 · 13 Nov 2025

## Example

```ts
import * as logs from 'aws-cdk-lib/aws-logs';

const apiKeyProvider: appsync.AppSyncAuthProvider = {
  authorizationType: appsync.AppSyncAuthorizationType.API_KEY,
};

const api = new appsync.EventApi(this, 'api', {
  apiName: 'Api',
  ownerContact: 'OwnerContact',
  authorizationConfig: {
    authProviders: [
      apiKeyProvider,
    ],
    connectionAuthModeTypes: [
      appsync.AppSyncAuthorizationType.API_KEY,
    ],
    defaultPublishAuthModeTypes: [
      appsync.AppSyncAuthorizationType.API_KEY,
    ],
    defaultSubscribeAuthModeTypes: [
      appsync.AppSyncAuthorizationType.API_KEY,
    ],
  },
  logConfig: {
    fieldLogLevel: appsync.AppSyncFieldLogLevel.INFO,
    retention: logs.RetentionDays.ONE_WEEK,
  },
});

api.addChannelNamespace('default');
```

## Properties

- `excludeVerboseContent`: boolean = false — exclude verbose content.

- `fieldLogLevel`: [AppSyncFieldLogLevel](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.AppSyncFieldLogLevel.html) — log level for fields.

  **Default:** Use AppSync default

- `retention`: [RetentionDays](/cdk/api/v2/docs/aws-cdk-lib.aws_logs.RetentionDays.html) = RetentionDays.INFINITE — The number of days log events are kept in CloudWatch Logs.

  By default AppSync keeps the logs infinitely. When updating this property,
  unsetting it doesn't remove the log retention policy.
  To remove the retention policy, set the value to `INFINITE`

- `role`: [IRoleRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_iam.IRoleRef.html) = None — The role for CloudWatch Logs.
