Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Enable Logging for API Gateway Stages Rule

This rule highlights the importance of enabling logging for API Gateway stages to ensure compliance and security.

RuleAPI Gateway stage logging should be enabled
FrameworkFedRAMP Moderate Revision 4
Severity
High

Rule Description:

The API Gateway stage logging should be enabled for FedRAMP Moderate Revision 4 compliance. This rule ensures that logging is enabled for all stages in API Gateway, which helps in monitoring and tracking the API usage, detecting security incidents, and ensuring compliance with regulatory requirements.

Enabling stage logging allows you to capture detailed information about requests and responses made to your API, including headers, parameters, and payloads. This information is invaluable for troubleshooting, analyzing usage patterns, and identifying potential security vulnerabilities.

Troubleshooting Steps:

If stage logging is not enabled for API Gateway, follow these steps to troubleshoot the issue:

  1. 1.

    Check API Gateway settings: Ensure that the logging settings for each stage in API Gateway are properly configured. Navigate to the API Gateway management console, select the desired API, and go to the "Stages" section. Verify if the logging settings are enabled for each stage.

  2. 2.

    IAM permissions: Ensure that the IAM roles associated with your API Gateway have the necessary permissions to write logs to the desired destination. Check the IAM policies associated with the roles and verify if they have the required permissions for CloudWatch Logs or any other logging service being used.

  3. 3.

    CloudWatch Logs configuration: If CloudWatch Logs is used as the logging service, verify the configuration. Ensure that the log groups and log streams are properly set up, and the appropriate retention and access control policies are in place.

  4. 4.

    API Gateway deployment: Check if the API Gateway deployment is successful and there are no errors encountered during the process. If there are any errors, address them and redeploy the API.

  5. 5.

    Test API request/response logging: Make test requests to the API and check if the logs are generated as expected. Verify if the logs contain the necessary information, such as headers, parameters, and payloads.

Necessary Codes:

There are no specific codes required for enabling stage logging in API Gateway. This configuration is done through the API Gateway management console or API Gateway REST API.

Step-by-step Guide for Enabling API Gateway Stage Logging:

Follow these steps to enable stage logging in API Gateway:

  1. 1.

    Open the API Gateway management console.

  2. 2.

    Select the desired API.

  3. 3.

    In the left navigation panel, click on "Stages".

  4. 4.

    Select the stage for which you want to enable logging.

  5. 5.

    Click on the "Logs/Tracing" tab.

  6. 6.

    Under the "CloudWatch Settings" section, select the option to enable "Enable CloudWatch Logs".

  7. 7.

    Choose the desired log level, such as "INFO", "ERROR", or "OFF". INFO level logs all requests and responses, ERROR level logs only error responses, and OFF disables logging.

  8. 8.

    If you want to specify a log group and log stream, enter the appropriate values. Otherwise, API Gateway will create a default log group and log stream.

  9. 9.

    Click on "Save Changes" to enable stage logging.

  10. 10.

    Repeat steps 4-9 for each stage in API Gateway that needs to have logging enabled.

Conclusion:

Enabling stage logging in API Gateway is essential for ensuring compliance with FedRAMP Moderate Revision 4 requirements. By following the troubleshooting steps and using the provided guide, you can easily enable stage logging, capture detailed request/response information, and maintain a secure and compliant API Gateway implementation.

Is your System Free of Underlying Vulnerabilities?
Find Out Now