# Ensure API Gateway has logging enabled

- Source: https://support.icompaas.com/support/solutions/articles/62000223276-ensure-api-gateway-has-logging-enabled
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [Security Controls](https://support.icompaas.com/support/solutions/62000065178) › [AWS Services](https://support.icompaas.com/support/solutions/folders/62000097507)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

**DESCRIPTION:**

Enabling the custom access logging option in API Gateway allows delivery of custom logs to Cloud Watch Logs, which can be analyzed using Cloud Watch Logs Insights. Using custom domain names in Amazon API Gateway allows insights into requests sent to each custom domain name. If there is more than one custom domain name mapped to a single API, understanding the quantity and type of requests by domain name may help understand request patterns.

  

**RATIONALE:**

Access logs contain details about who accessed your API and how they accessed it. which can also be used for troubleshooting API errors.  

  

**IMPACT  :**

API Gateway Access Logs are disabled by default and need to be enabled on AWS. It easily monitors the resources that we are using. Flexible in security control.

  

**DEFAULT VALUE :**

API Gateway Access logs are disabled.

  

**PREREQUISITES:**

-   Sign in as admin or IAM user with required permissions
    
-   Before the follow the implementation steps you must have an API gateway that is deployed.
    

**REMEDIATION:**

  

**TEST PLAN:**

-   Log on to the AWS management console
    
-   Go to Amazon API console [https://console.aws.amazon.com/apigateway](https://console.aws.amazon.com/apigateway)
    
-   In the APIs pane
    
-   Choose the API which one we want to examine
    
-   Click on the Stages![](https://support.icompaas.com/assets/kb/ab7f55ead8a8e082.png)
    

-   Click on Logs/Tracing  
      
    ![](https://support.icompaas.com/assets/kb/a134d6e33f3d95c4.png)
-   Check whether Enable Access Logging is checked/unchecked.![](https://support.icompaas.com/assets/kb/57d5c676a10c7a17.png)

  

**Using AWS CLI:**

The above command will provide the API stages of it’s kind.

aws apigateway get-stages --region us-east-1 --rest-api-id <api\_id> 

  

**IMPLEMENTATION:**

-   Sign in to AWS MANAGEMENT CONSOLE.
    
-   Go to the API Gateway console [https://console.aws.amazon.com/apigateway](https://console.aws.amazon.com/apigateway "https://console.aws.amazon.com/apigateway")
    
-   Click on APIs**,** in the left navigation pane
    
-   Choose the API you want to enable the Logging.
    
-   In the navigation panel, in the API submenu, click Stages to list the stages created for the selected API.  
    ![](https://support.icompaas.com/assets/kb/5f9ca78f46c151cc.png)
    
    -   In LOGS/TRACING tab, check to ENABLE ACCESS ENABLE check the box to enable![](https://support.icompaas.com/assets/kb/e8a5ef54bd2d6a07.png)  
        
    -   Copy the ARN of the cloud watch which was created earlier for API GATEWAY and gives all the access for API gateway![](https://support.icompaas.com/assets/kb/5ff3fc20ef1e2cdc.png)

  

-   Paste ARN of the role. click on save and Click on JSON![](https://support.icompaas.com/assets/kb/72523b8a783f07de.png)
    
-   Click on save changes.

aws apigateway update-stage
  --region <value>
  --rest-api-id <value>
  --stage-name '<value>'
  --patch-operations op=replace,path=/\*/\*/logging/loglevel,value=INFO op=replace,path=/\*/\*/logging/dataTrace,value=true

  

**BACKOUT PLAN :**

-   Login to AWS Management Console
    
-   Go to the Amazon API Gateway console a [https://console.aws.amazon.com/apigatewa](https://console.aws.amazon.com/apigatewa)
    
-   Choose API
    
-   In the navigation panel, in the API submenu, click  Stages to list the stages created for the selected API. 
    
-   In the Logs/Tracing tab click on uncheck the box to disable
    
-   Click on the Save changes button
    

  

  

  

**Using AWS CLI:**

aws apigateway update-stage
  --region <value>
  --rest-api-id <value>
  --stage-name '<value>'
  --patch-operations op=replace,path=/\*/\*/logging/loglevel,value=INFO op=replace,path=/\*/\*/logging/dataTrace,value=false

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
