π‘οΈ AWS API Gateway API Execution Logging in CloudWatch is not enabledπ’
- Contextual name: π‘οΈ API Execution Logging in CloudWatch is not enabledπ’
- ID:
/ce/ca/aws/apigateway/api-execution-logging - Tags:
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
PERFORMANCE,RELIABILITY
Logicβ
- π§ prod.logic.yamlπ’
Similar Policiesβ
- Internal:
dec-x-2ac6c302
Similar Internal Rulesβ
| Rule | Policies | Flags |
|---|---|---|
| βοΈ dec-x-2ac6c302 | 1 |
Descriptionβ
Descriptionβ
AWS API Gateway should have API Execution Logging enabled in CloudWatch to support effective monitoring and troubleshooting. Enabling execution logging in CloudWatch provides insight into API requests, error rates, and latency, helping detect and respond to issues promptly.
Rationaleβ
Enabling API execution logging in CloudWatch helps monitor API usage and performance, as well as identify and troubleshoot issues in real-time. It enhances visibility into API traffic patterns, execution errors, and latencies, facilitating better management of APIs.
Impactβ
Enabling CloudWatch logging may increase CloudWatch costs due to additional logging data.
Auditβ
This policy will mark an AWS API Gateway API as
INCOMPLIANTif theCloudWatch Logging Levelfield in a related API Stage object is either empty or set to OFF.For API Gateway HTTP APIs (identified by the
Protocol Typefield set to HTTP), the policy object will be marked asINAPPLICABLEbecause HTTP APIs do not support execution logging.
Remediationβ
Remediationβ
Prerequisitesβ
To enable CloudWatch Logs, grant API Gateway permission to read and write logs to CloudWatch in your account. The managed policy
AmazonAPIGatewayPushToCloudWatchLogs(ARN:arn:aws:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs) provides the necessary permissions:{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:DescribeLogGroups",
"logs:DescribeLogStreams",
"logs:PutLogEvents",
"logs:GetLogEvents",
"logs:FilterLogEvents"
],
"Resource": "*"
}
]
}To set up these permissions:
- Create an IAM role with
apigateway.amazonaws.comas the trusted entity.- Attach the above policy to the IAM role.
- Set the IAM role ARN in the
cloudWatchRoleArnproperty of yourAccount. Note that you must configure thecloudWatchRoleArnseparately for each AWS Region where you wish to enable CloudWatch Logs.... see more