Log Analysis
Scenario
This section describes how to obtain and analyze the API calling logs of dedicated gateways.
Prerequisites
APIs have been called.
Procedure
- Log in to the management console.
- Click
in the upper left corner and choose API Gateway.
- In the navigation pane, choose Dedicated Gateways. Then click Access Console in the upper right corner of a dedicated gateway.
- Choose , and click Configure Log Collection.
- Enable log collection (
).
- Specify a log group and log stream, and click OK. For details about log groups and log streams, see section "Log Management" in the Log Tank Service User Guide.
- Click Log Fields to view the description of each log field. Then view and analyze logs by referring to the log field descriptions.
- To export logs, see section "Log Transfer" in the Log Tank Service User Guide.
Fields in access logs are separated using spaces. The following table describes each log field.
Table 1 Log field description No.
Field
Description
1
remote_addr
Client IP address
2
request_id
Request ID
3
api_id
API ID
4
user_id
Project ID provided by a requester for IAM authentication
5
app_id
App ID provided by a requester for app-based authentication
6
time_local
Time when a request is received
7
request_time
Request latency
8
request_method
HTTP request method
9
host
Domain name
10
router_uri
Request URI
11
server_protocol
Request protocol
12
status
Response status code
13
bytes_sent
Response size in bytes, including the status line, header, and body.
14
request_length
Request length in bytes, including the start line, header, and body.
15
http_user_agent
User agent ID
16
http_x_forwarded_for
X-Forwarded-For header field
17
upstream_addr
Backend address
18
upstream_uri
Backend URI
19
upstream_status
Backend response code
20
upstream_connect_time
Time taken for establishing a connection with the backend
21
upstream_header_time
Duration from the beginning of the establishment of a connection to receiving the first byte from the backend
22
upstream_response_time
Duration from the beginning of the establishment of a connection to receiving the last byte from the backend
23
region_id
Region ID
24
all_upstream_response_time
Duration (seconds) from the beginning of the establishment of a connection to receiving the last byte from the backend. When a retry occurs, the value is the total time used.
25
errorType
Request error type. Options:
- 0: non-throttling error
- 1: throttling error
26
auth_type
API authentication mode
27
access_model1
Authentication mode 1
28
access_model2
Authentication mode 2. When two-factor authentication is enabled, the custom authorizer ID is used.
29
inner_time
Internal processing duration of APIG, in seconds
30
proxy_protocol_vni
VPC endpoint virtual network ID
31
proxy_protocol_vpce_id
VPC endpoint ID
32
proxy_protocol_addr
Client IP address
33
body_bytes_sent
Size of the API request body, in bytes
34
api_name
API name
35
app_name
Name of the app used by the requester when app authentication is used
36
provider_app_id
ID of the app to which the API belongs
37
provider_app_name
Name of the app to which the API belongs
38
custom_data_log1
Custom log field 1
39
custom_data_log2
Custom log field 2
40
custom_data_log3
Custom log field 3
41
custom_data_log4
Custom log field 4
42
custom_data_log5
Custom log field 5
43
custom_data_log6
Custom log field 6
44
custom_data_log7
Custom log field 7
45
custom_data_log8
Custom log field 8
46
custom_data_log9
Custom log field 9
47
custom_data_log10
Custom log field 10
48
response_source
Response source. Options:
- local: APIG
- remote: backend service
- Scenario
- Prerequisites
- Procedure