观测分析 操作步骤 1. 登录 云原生API网关控制台。 2. 在左侧导航栏,选择 "实例",并在顶部菜单栏选择地域。 3. 进入实例详情页,在左侧导航栏中,选择 "观测分析"。 4. 选择 "日志中心",有三个步骤进行开启: 检查是否开启委托授权,如未开启,需要点击 "立即创建",创建名为CtyunAgwAdminTrust的委托授权。 检查是否开通日志服务,如未开通,需要点击 "立即开通",开通日志服务。 检查是否接入日志,如未接入,需要点击 "开启",接入日志服务。 说明 日志和链路追踪的启用需要您授权云原生API网关访问云日志服务和应用性能监控服务的权限,允许使用相关资源。 日志和链路追踪服务将根据您的使用量进行收费。 访问日志格式说明 网关访问日志示例 plaintext { "starttime": 1725411921254, "request": { "size": 335, "method": "POST", "uri": "/foo/bar", "headers": { "accept": "text/plain, application/json, application/+json, /", "contentlength": "0", "ubertraceid": "b32bce4ff1f00f7b:899a1fd65c39be02:1c3372663d9eae03:0", "connection": "keepalive", "useragent": "Java/1.8.0212", "host": "foo.ctyun.com", "contenttype": "application/json" }, "url": " "querystring": {} }, "serviceid": "a4db25fc03294d5dbeb9e7752381c972", "server": { "version": "3.2.2", "hostname": "agwvmxxxxxx" }, "agwlatency": 0, "latency": 24.00016784668, "clientip": "100.89.x.x", "response": { "size": 625, "headers": { "via": "1.1 alb/v3.4.5", "contentlength": "427", "date": "Wed, 04 Sep 2024 01:05:21 GMT", "connection": "close", "server": "AGW/3.2.2", "contenttype": "application/json;charsetUTF8" }, "status": 400 }, "upstream": { "upstreamaddr": "10.121.x.x:80", "upstreamstatus": "400", "upstreamlatency": 25, "upstreamname": "fooservice" }, "routeid": "ddd342a2a3f34405bb8650ad4e", "routename": "testroute" } 日志索引字段说明如下 字段 说明 taghostIp 数据来源主机IP taghostName 数据来源主机名称 request.url 请求url request.uri 请求uri routename 路由名称 response.status 响应结果状态 upstream.upstreamname 上游服务名称 upstream.upstreamaddr 上游服务地址