This rule ensures that API Gateway stage logging is enabled for Protect (PR) benchmark.
Rule | API Gateway stage logging should be enabled |
Framework | NIST Cybersecurity Framework (CSF) v1.1 |
Severity | ✔ High |
Rule Description
The API Gateway stage logging should be enabled to comply with the NIST Cybersecurity Framework (CSF) v1. Enabling stage logging ensures that all request and response data in the API Gateway stage is logged for improved monitoring, troubleshooting, and security analysis.
Enabling stage logging provides valuable insights into the behavior of your API, helps in identifying potential security threats, and allows for analyzing API traffic patterns.
Troubleshooting Steps
If you encounter any issues while enabling stage logging, follow the troubleshooting steps below:
Code Example
To enable stage logging for the API Gateway, you can use the AWS Command Line Interface (CLI). Below is an example command:
aws apigateway update-stage --rest-api-id YOUR_REST_API_ID --stage-name YOUR_STAGE_NAME --patch-operations op=replace,path=/logging/dataTrace,value=true
Replace
YOUR_REST_API_ID
with the ID of the target REST API and YOUR_STAGE_NAME
with the name of the API Gateway stage where you want to enable stage logging.Ensure that you have the AWS CLI installed and configured with the necessary credentials and region before executing the command.
Remediation Steps
To enable API Gateway stage logging using the AWS Management Console, follow the step-by-step guide below:
After completing these steps, the stage logging for the API Gateway will be enabled, and all request and response data will be logged for the NIST Cybersecurity Framework (CSF) v1 compliance.
Remember to repeat these steps for each stage of your API Gateway if you have multiple stages requiring stage logging.