All checks
Medium AppSync · regional

AWS AppSync should have field-level logging enabled

Checks that an AWS AppSync GraphQL API sends field-level resolver logs to CloudWatch Logs at the Error or All level; None, Info and Debug fail. Field-level logs record each field's resolver request, response and errors, which helps you identify, troubleshoot and respond to issues with API requests.

service
AppSync
severity
Medium
scope
evaluated in every region

How to fix it

In the console

AppSync → APIs → the API → Settings → Logging

Enable Logs
On
Field resolver log level
Error, or All, which also logs the data every field resolves to
Create or use an existing role
New role, or a role AppSync can assume that allows logs:CreateLogGroup, logs:CreateLogStream and logs:PutLogEvents

With the AWS CLI

  • Overwrites existing settings: The CLI call replaces the API's settings rather than merging them, so read the API with get-graphql-api first and resupply its authorization modes, X-Ray and other settings.
aws appsync update-graphql-api --api-id <api-id> --name <api-name> --authentication-type <authentication-type> --log-config fieldLogLevel=ERROR,cloudWatchLogsRoleArn=<logs-role-arn> --region <region>

With Terraform

resource "aws_appsync_graphql_api" "this" {
  name                = var.api_name
  authentication_type = var.authentication_type

  log_config {
    cloudwatch_logs_role_arn = var.logs_role_arn
    field_log_level          = "ERROR"
  }
}

See which of your accounts this check is failing on.

Book a live scan