Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Jan 13, 2025

Enable logging

You can enable logging to debug your GraphQL API using Amazon CloudWatch logs. To learn more about logging and monitoring capabilities for your GraphQL API, visit the AWS AppSync documentation for logging and monitoring.

Enable default logging configuration

Default logging can be enabled by setting the logging property to true in the call to defineData. For example:

amplify/data/resource.ts
export const data = defineData({
// ...
logging: true
});

Using logging: true applies the default configuration:

Customize logging configuration

You can customize individual configuration values by providing a DataLogConfig object. For example:

amplify/data/resource.ts
export const data = defineData({
// ...
logging: {
excludeVerboseContent: false,
fieldLogLevel: 'all',
retention: '1 month'
}
});

WARNING: Setting excludeVerboseContent to false logs full queries and user parameters, which can contain sensitive data. We recommend limiting CloudWatch log access to only those roles or users (e.g., DevOps or developers) who genuinely require it, by carefully scoping your IAM policies.

Configuration Properties

logging

  • true: Enables default logging.
  • DataLogConfig object: Overrides one or more default fields.

DataLogConfig Fields

  • excludeVerboseContent?: boolean

  • fieldLogLevel?: DataLogLevel

  • retention?: LogRetention

    • Number of days to keep the logs
    • Defaults to '1 week'
    • Supported values of Enum RetentionDays:
      • '1 day'
      • '3 days'
      • '5 days'
      • '1 week'
      • '2 weeks'
      • '1 month'
      • '2 months'
      • '3 months'
      • '4 months'
      • '5 months'
      • '6 months'
      • '1 year'
      • '13 months'
      • '18 months'
      • '2 years'
      • '5 years'
      • '10 years'
      • 'infinite'