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.
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.
Detailed call logs: You can search for the details of API call logs.
Customized analysis chart: You can customize any log item into a statistical chart according to the statistical requirement to meet your business needs.
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.
|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.|
|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).|
Create a project and a Logstore.
Skip this step if a Logstore already exists.
Enter the data import wizard.
After creating a Logstore, click the Data Import Wizard icon on the Logstore List page.
Select a data source.
Click API Gateway in Cloud Services, and then click Next to go to the Configure Data Source step.
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.
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.