edit-icon download-icon

Access logs of API Gateway

Last Updated: Jul 28, 2018

Alibaba Cloud API Gateway provides API hosting service to facilitate microservice aggregation, frontend and backend isolation, and system integration. An access log is a log generated by Web services. Each API request corresponds to an access record, containing caller IP, requested URL, response latency, returned status code, number of bytes for each request and response, and other information. With the preceding information, you can understand the operation status of your Web services.


With Log Service, you can collect access logs of the API Gateway by using Data Import Wizard. For more information, see API Gateway.


  1. Online log query: You can perform a rapid accurate or fuzzy query by using any keyword in the log. This feature can be used to locate a problem or count the queries.

  2. Detailed call logs: You can search for the details of API call logs.

  3. Customized analysis chart: You can customize any log item into a statistical chart according to the statistical requirement to meet your business needs.

  4. Preset analysis report: API Gateway predefines some global statistical charts, including request volume, success rate, failure rate, latency, the number of applications that call APIs, failure statistics, Top grouping, Top API, and Top latency.

Field description

Log field Description
apiGroupUid The API group ID.
apiGroupName The API group name.
apiUid The API ID.
apiName The API name.
apiStageUid The API stage ID.
apiStageName The API stage name.
httpMethod The called HTTP method.
path The requested path.
domain The called domain name.
statusCode HttpStatusCode
errorMessage The error message.
appId The application ID of the caller.
appName The application name of the caller.
clientIp The client IP of the caller.
exception The specific error message returned by backend.
providerAliUid The account ID of the API provider.
region Region, such as cn-hangzhou.
requestHandleTime The request time (GMT).
requestId The request ID, which is globally unique.
requestSize The size of the request (in bytes).
responseSize The size of the returned data (in bytes).
serviceLatency The backend latency (in milliseconds).


  1. Create a project and a Logstore.

    For how to create a project and a Logstore, see Create a project in Manage a project and Create a Logstore in Manage a Logstore.

    Skip this step if a Logstore already exists.

  2. Enter the data import wizard.

    After creating a Logstore, click the Data Import Wizard icon 1 on the Logstore List page.

  3. Select a data source.

    Click API Gateway in Cloud Services, and then click Next to go to the Configure Data Source step.

  4. Configure the data source.

    In the Configure Data Source step, check whether you have completed the following configurations:

    • Activate the API Gateway service.

      API Gateway provides a complete API hosting service, helping you open capabilities, services, and data to your partners in the form of API. You can also release APIs on the API marketplace for other developers to purchase.

      If you have not activated the API Gateway service, activate it as instructed on the relevant page.

    • Complete Resource Access Management (RAM) authorization.

      Authorize Log Service by using RAM before establishing a dispatch rule, so that Log Service can collect your API Gateway logs.

      Click Authorize in the upper-right corner for quick authorization.

    • Establish a dispatch rule.

      If you do this for the first time, the system automatically imports API Gateway logs and establishes a dispatch rule. If you have configured API Gateway log collection before, a message indicating the log dispatch rule already exists is displayed. You can select to delete the existing dispatch rule.

    Click Next to enter the Search, Analysis, and Visualization page.

  5. Configure Search, Analysis, and Visualization.

    Configure indexes as shown in the following figure. The configuration of the indexes is related to your log search and analysis efficiency. You will also use this configuration in Dashboard, so proceed with caution when modifying this configuration.


    Click Next to complete the configuration. Log shipper can be configured separately when necessary.

You have finished the data import wizard initialization. You can select the configured Logstore api-gateway-access-log to query and analyze logs, or go to Dashboard to view reports.

You can modify or delete the configuration in the API Gateway console based on the API Gateway documentation.

Thank you! We've received your feedback.