Alibaba Cloud API Gateway provides API hosting service to facilitate micro-service aggregation, frontend and backend isolation, and system integration. Each API request corresponds to an access record, which contains information such as the IP address of the API caller, requested URL, response latency, returned status code, and number of bytes for each request and response. With the preceding information, you can understand the operating status of your web services.
Log Service allows you to collect API Gateway access logs by using the data import wizard.
- Online log querying: You can use any keywords to query logs. Both exact query and fuzzy matching are supported. Log query can be used for troubleshooting or statistical query.
- Detailed API call logs: You can search for detailed API call logs.
- Customized analysis charts: You can customize charts based on any log data to meet your statistical and business requirements.
- Preset analysis reports: API Gateway has predefined global statistical charts, including those for the number of requests, success rate, failure rate, latency, the number of applications that call APIs, failure statistics, top groups, top APIs, and top latency.
|apiGroupUid||The ID of the API group.|
|apiGroupName||The name of the API group.|
|apiUid||The ID of the API.|
|apiName||The name of the API.|
|apiStageUid||The ID of the API stage.|
|apiStageName||The name of the API stage.|
|httpMethod||The HTTP method of the request.|
|path||The request path.|
|domain||The domain name that sends the request.|
|statusCode||The HTTP status code.|
|errorMessage||The error message.|
|appId||The ID of the application that sends the request.|
|appName||The name of the application that sends the request.|
|clientIp||The IP address of the client that sends the request.|
|exception||The specific error message returned by the backend server.|
|providerAliUid||The account ID of the API provider.|
|region||The ID of the region, such as cn-hangzhou.|
|requestHandleTime||The time when the request is sent. It must be in GMT.|
|requestId||The request ID. It must be globally unique.|
|requestSize||The size of the request message. Unit: bytes.|
|responseSize||The size of the response message. Unit: bytes.|
|serviceLatency||The backend latency. Unit: ms.|
- Create a project and a Logstore.
Skip this step if a Logstore already exists.
- Expand the target Logstore and click the plus sign (+) icon next to Data Import.
You can also click the Import Data button on the right of the page, and select a Logstore in the data import process.
- Select a data type.
Click API Gateway on the Import Data page.
- Select a Logstore.
The system skips this step if you enter the log collection configuration process by clicking the plus sign (+) icon next to Data Import under a Logstore on the Logstores page.
- Specify the data source.
In the step of specifying the data source, check whether you have completed the following configurations:
- Activate API Gateway.
API Gateway provides a complete suite of API hosting services, helping you share services and data with partners in the form of APIs. It also allows you to release your APIs in the API marketplace for more developers to purchase and use.
If you have not activated API Gateway, activate it as instructed on the relevant page.
- Complete RAM authorization.
Use RAM to authorize Log Service before you establish a dispatch rule. This allows Log Service to collect your API Gateway logs.
Click Authorize in the upper-right corner for quick authorization.
- Create a dispatch rule.
If this is the first dispatch rule that you create, the system automatically imports API Gateway logs and creates a dispatch rule. If you have configured API Gateway log collection, a message indicating that the log dispatch rule already exists is displayed. You can delete the existing dispatch rule.
- Activate API Gateway.
- Configure query and analysis.
By default, Log Service creates indexes for you. To create or modify indexes, chooseon the search and analysis page.
You have completed data import initialization. You can select the api-gateway-access-log Logstore to query and analyze logs, or go to the dashboard page to view reports.