This rule ensures that API Gateway stage logging is enabled for enhanced monitoring and security measures.
Rule | API Gateway stage logging should be enabled |
Framework | CISA-cyber-essentials |
Severity | ✔ High |
Rule Description: API Gateway stage logging should be enabled for CISA-cyber-essentials
Enabling API Gateway stage logging is important for tracking and monitoring the activities and requests made to an API. This is especially crucial for CISA-cyber-essentials compliance, as it ensures that logs are generated and retained to meet security and auditing requirements.
Troubleshooting Steps:
If API Gateway stage logging is not enabled for CISA-cyber-essentials, follow these troubleshooting steps:
logs:CreateLogGroup
, logs:CreateLogStream
, and logs:PutLogEvents
.Necessary Code:
If stage logging is not already enabled for CISA-cyber-essentials, you can use the following AWS CLI command to update the stage settings:
aws apigateway update-stage --rest-api-id <rest_api_id> --stage-name <stage_name> --patch-operations op="replace",path="/logging/loglevel",value="INFO"
Replace
<rest_api_id>
with the ID of your API Gateway and <stage_name>
with the name of the stage associated with CISA-cyber-essentials. This command sets the logging level to INFO
, but you can adjust it as per your requirements.Step-by-step Guide for Remediation:
To enable API Gateway stage logging for CISA-cyber-essentials, follow these steps:
By following these steps, you will successfully enable API Gateway stage logging for CISA-cyber-essentials compliance. Make sure to retain the logs for the required duration as per your organization's policies and regulatory requirements.