Alibaba Cloud API Gateway provides API hosting service to facilitate micro-service aggregation, frontend/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.
- Online log query: You can perform a rapid accurate or fuzzy search using any keyword in the log. This feature can be used to locate a problem or count queries.
- Detailed call logs: You can search for 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: In the API Gateway, some global statistical charts are predefined, 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||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||The HTTP status code.|
|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||such as cn-hangzhou|
|requestHandleTime||The request time (GMT).|
|RequestId||The request ID, which is globally unique.|
|requestSize||The size of the returned data (in bytes).|
|Responsesize||The size of the returned data (in bytes).|
|Servicelatency||The backend latency (in milliseconds).|
- Create a project and a Logstore.
For how to create a project and a Logstore, see Preparation.
Skip this step if a Logstore already exists.
- Enter the data access wizard.
After creating a Logstore, click the Data Import Wizard icon on theLogstore 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.
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.
- Activate the API Gateway service.
- 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.