From dd320bab8399dd6cb295324004f92eac045865d5 Mon Sep 17 00:00:00 2001 From: my-git9 Date: Sun, 6 Aug 2023 21:50:03 +0800 Subject: [PATCH] [zh] sync observability/logs/* zipkin (#13697) Signed-off-by: xin.li --- .../distributed-tracing/zipkin/index.md | 22 ++++---- .../observability/logs/access-log/index.md | 53 +++++++++++-------- .../observability/logs/otel-provider/index.md | 17 +++--- .../observability/logs/telemetry-api/index.md | 12 ++--- 4 files changed, 58 insertions(+), 46 deletions(-) diff --git a/content/zh/docs/tasks/observability/distributed-tracing/zipkin/index.md b/content/zh/docs/tasks/observability/distributed-tracing/zipkin/index.md index 52880f4e06..c8948624f8 100644 --- a/content/zh/docs/tasks/observability/distributed-tracing/zipkin/index.md +++ b/content/zh/docs/tasks/observability/distributed-tracing/zipkin/index.md @@ -9,25 +9,27 @@ owner: istio/wg-policies-and-telemetry-maintainers test: yes --- -通过本任务,您将了解如何使应用程序可被 [Zipkin](https://zipkin.io/) 追踪,而无需考虑应用程序使用何种开发语言、框架或平台。 +通过本任务,您将了解如何使应用程序可被 [Zipkin](https://zipkin.io/) 追踪, +而无需考虑应用程序使用何种开发语言、框架或平台。 本任务使用 [Bookinfo](/zh/docs/examples/bookinfo/) 作为示例应用程序。 要了解 Istio 如何处理追踪,请访问此任务的[概述](../overview/)。 -## 开始之前{#before-you-begin} +## 开始之前 {#before-you-begin} 1. 参考 [Zipkin 安装](/zh/docs/setup/install/istioctl)文档将 Zipkin 安装到您的集群中。 1. 启用追踪时,您可以设置 Istio 用于追踪的 Sampling Rate。 - 安装时使用 `meshConfig.defaultConfig.tracing.sampling` [设置 Sampling Rate](/zh/docs/tasks/observability/distributed-tracing/configurability/#customizing-trace-sampling)。 + 安装时使用 `meshConfig.defaultConfig.tracing.sampling` + [设置 Sampling Rate](/zh/docs/tasks/observability/distributed-tracing/configurability/#customizing-trace-sampling), 默认的 Sampling Rate 为 1%。 1. 部署 [Bookinfo](/zh/docs/examples/bookinfo/#deploying-the-application) 示例应用程序。 -## 访问仪表盘{#accessing-the-dashboard} +## 访问仪表盘 {#accessing-the-dashboard} -[远程访问遥测插件](/zh/docs/tasks/observability/gateways)详细介绍了如何通过网关配置对 Istio 插件的访问 +[远程访问遥测插件](/zh/docs/tasks/observability/gateways)详细介绍了如何通过网关配置对 Istio 插件的访问。 对于测试(或临时访问),您也可以使用端口转发。假设已将 Zipkin 部署到 `istio-system` 命名空间,请使用以下内容: @@ -35,13 +37,14 @@ test: yes $ istioctl dashboard zipkin {{< /text >}} -## 使用 Bookinfo 示例产生追踪{#generating-traces-using-the-Bookinfo-sample} +## 使用 Bookinfo 示例产生追踪 {#generating-traces-using-the-Bookinfo-sample} 1. 当 Bookinfo 应用程序启动并运行时,访问 `http://$GATEWAY_URL/productpage` 一次或多次以生成追踪信息。 {{< boilerplate trace-generation >}} -1. 在搜索面板中,点击 “+” 号,从第一个下拉列表中选择 `serviceName`,从第二个下拉列表中选择 `productpage.default`,再点击搜索图标: +1. 在搜索面板中,点击 `+` 号,从第一个下拉列表中选择 `serviceName`, + 从第二个下拉列表中选择 `productpage.default`,再点击搜索图标: {{< image link="./istio-tracing-list-zipkin.png" caption="Tracing Dashboard" >}} @@ -49,9 +52,10 @@ $ istioctl dashboard zipkin {{< image link="./istio-tracing-details-zipkin.png" caption="Detailed Trace View" >}} -1. 追踪由一组 Span 组成,其中每个 Span 对应一个 Bookinfo Service,这些服务在执行 `/productpage` 请求或 Istio 内部组件时被调用,例如:`istio-ingressgateway`。 +1. 追踪由一组 Span 组成,其中每个 Span 对应一个 Bookinfo Service,这些服务在执行 + `/productpage` 请求或 Istio 内部组件时被调用,例如:`istio-ingressgateway`。 -## 清理{#cleanup} +## 清理 {#cleanup} 1. 使用 Control-C 或删除任何可能仍在运行的 `istioctl` 进程: diff --git a/content/zh/docs/tasks/observability/logs/access-log/index.md b/content/zh/docs/tasks/observability/logs/access-log/index.md index fad27864d3..9ea6dbf5e2 100644 --- a/content/zh/docs/tasks/observability/logs/access-log/index.md +++ b/content/zh/docs/tasks/observability/logs/access-log/index.md @@ -10,19 +10,21 @@ owner: istio/wg-policies-and-telemetry-maintainers test: yes --- -Istio 最简单的日志类型是 [Envoy 的访问日志](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage)。Envoy 代理打印访问信息到标准输出。Envoy 容器的标准输出能够通过 `kubectl logs` 命令打印出来。 +Istio 最简单的日志类型是 +[Envoy 的访问日志](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage)。 +Envoy 代理打印访问信息到标准输出。Envoy 容器的标准输出能够通过 `kubectl logs` 命令打印出来。 {{< boilerplate before-you-begin-egress >}} {{< boilerplate start-httpbin-service >}} -## 开启 Envoy 访问日志{#enable-envoy-s-access-logging} +## 开启 Envoy 访问日志 {#enable-envoy-s-access-logging} -Istio 提供了几种启用访问日志的方法。建议使用遥测 API +Istio 提供了几种启用访问日志的方法,建议使用 Telemetry API。 -### 使用遥测 API{#using-telemetry-API} +### 使用 Telemetry API {#using-telemetry-API} -遥测 API 可以开启或关闭访问日志: +Telemetry API 可以开启或关闭访问日志: {{< text yaml >}} apiVersion: telemetry.istio.io/v1alpha1 @@ -40,11 +42,11 @@ spec: 类似的配置也可以应用于单独的命名空间或单独的工作负载,以在细粒度级别控制日志记录。 -关于使用遥测 API 的更多信息,请参见[遥测 API 概述](/zh/docs/tasks/observability/telemetry/)。 +关于使用 Telemetry API 的更多信息,请参见 [Telemetry API 概述](/zh/docs/tasks/observability/telemetry/)。 -### 使用网格配置{#using-mesh-config} +### 使用网格配置 {#using-mesh-config} -如果您使用 `IstioOperator` CR 来安装 Istio,请在您的配置中添加以下字段: +如果您使用 `IstioOperator` CR 来安装 Istio,请在您的配置中添加以下字段: {{< text yaml >}} spec: @@ -52,7 +54,7 @@ spec: accessLogFile: /dev/stdout {{< /text >}} -否则,在原来的 `istioctl install` 命令中添加相同的设置,例如: +或者,在原来的 `istioctl install` 命令中添加相同的设置,例如: {{< text syntax=bash snip_id=none >}} $ istioctl install --set meshConfig.accessLogFile=/dev/stdout @@ -60,17 +62,19 @@ $ istioctl install --set meshConfig.accessLogF 您也可以通过设置 `accessLogEncoding` 为 `JSON` 或 `TEXT` 来在两种格式之间切换。 -您也许希望通过设置 `accessLogFormat` 来自定义访问日志的[格式](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#format-rules)。 +您也许希望通过设置 `accessLogFormat` +来自定义访问日志的[格式](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#format-rules)。 -更多信息请参考[global mesh options](/zh/docs/reference/config/istio.mesh.v1alpha1/#MeshConfig)在这三个设置中: +有关所有这三个设置的更多信息,请参阅 +[global mesh options](/zh/docs/reference/config/istio.mesh.v1alpha1/#MeshConfig): * `meshConfig.accessLogFile` * `meshConfig.accessLogEncoding` * `meshConfig.accessLogFormat` -## 默认访问日志格式{#default-access-log-format} +## 默认访问日志格式 {#default-access-log-format} -如果没有指定 `accessLogFormat` Istio 将使用以下默认的访问日志格式: +如果没有指定 `accessLogFormat` Istio 将使用以下默认的访问日志格式: {{< text plain >}} [%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% %RESPONSE_CODE_DETAILS% %CONNECTION_TERMINATION_DETAILS% @@ -78,9 +82,9 @@ $ istioctl install --set meshConfig.accessLogF \"%REQ(:AUTHORITY)%\" \"%UPSTREAM_HOST%\" %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS% %REQUESTED_SERVER_NAME% %ROUTE_NAME%\n {{< /text >}} -下表显示了一个使用默认的访问日志格式的示例,请求从 `sleep` 发送到 `httpbin`: +下表显示了一个使用默认的访问日志格式的示例,请求从 `sleep` 发送到 `httpbin`: -| Log operator | access log in sleep | access log in httpbin | +| 日志运算符 | sleep 中的访问日志 | httpbin 中的访问日志 | |--------------|---------------------|-----------------------| | `[%START_TIME%]` | `[2020-11-25T21:26:18.409Z]` | `[2020-11-25T21:26:18.409Z]` | `\"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\"` | `"GET /status/418 HTTP/1.1"` | `"GET /status/418 HTTP/1.1"` @@ -105,9 +109,9 @@ $ istioctl install --set meshConfig.accessLogF | `%REQUESTED_SERVER_NAME%` | `-` | `outbound_.8000_._.httpbin.foo.svc.cluster.local` | `%ROUTE_NAME%` | `default` | `default` -## 测试访问日志{#test-the-access-log} +## 测试访问日志 {#test-the-access-log} -1. 从 `sleep` 向 `httpbin` 发送一个请求: +1. 从 `sleep` 向 `httpbin` 发送一个请求: {{< text bash >}} $ kubectl exec "$SOURCE_POD" -c sleep -- curl -sS -v httpbin:8000/status/418 @@ -127,32 +131,35 @@ $ istioctl install --set meshConfig.accessLogF `"""` {{< /text >}} -1. 检查 `sleep` 的日志: +1. 检查 `sleep` 的日志: {{< text bash >}} $ kubectl logs -l app=sleep -c istio-proxy [2019-03-06T09:31:27.354Z] "GET /status/418 HTTP/1.1" 418 - "-" 0 135 11 10 "-" "curl/7.60.0" "d209e46f-9ed5-9b61-bbdd-43e22662702a" "httpbin:8000" "172.30.146.73:80" outbound|8000||httpbin.default.svc.cluster.local - 172.21.13.94:8000 172.30.146.82:60290 - {{< /text >}} -1. 检查 `httpbin` 的日志: +1. 检查 `httpbin` 的日志: {{< text bash >}} $ kubectl logs -l app=httpbin -c istio-proxy [2019-03-06T09:31:27.360Z] "GET /status/418 HTTP/1.1" 418 - "-" 0 135 5 2 "-" "curl/7.60.0" "d209e46f-9ed5-9b61-bbdd-43e22662702a" "httpbin:8000" "127.0.0.1:80" inbound|8000|http|httpbin.default.svc.cluster.local - 172.30.146.73:80 172.30.146.82:38618 outbound_.8000_._.httpbin.default.svc.cluster.local {{< /text >}} -请注意,与请求相对应的信息分别出现在源(`sleep`)和目标(`httpbin`)的 Istio 代理日志中。您可以在日志中看到 HTTP 动词(`GET`)、HTTP 路径(`/status/418`)、响应码(`418`) 和其他[请求相关信息](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#format-rules)。 +请注意,与请求相对应的信息分别出现在源(`sleep`)和目标(`httpbin`)的 Istio +代理日志中。您可以在日志中看到 HTTP 动词(`GET`)、HTTP 路径(`/status/418`)、 +响应码(`418`)和其他[请求相关信息](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#format-rules)。 -## 清除{#cleanup} +## 清理 {#cleanup} -关闭 [sleep]({{}}/samples/sleep) 和 [httpbin]({{}}/samples/httpbin) 服务: +关闭 [sleep]({{}}/samples/sleep) 和 +[httpbin]({{}}/samples/httpbin) 服务: {{< text bash >}} $ kubectl delete -f @samples/sleep/sleep.yaml@ $ kubectl delete -f @samples/httpbin/httpbin.yaml@ {{< /text >}} -### 关闭 Envoy 的访问日志{#disable-envoy-s-access-logging} +### 关闭 Envoy 的访问日志 {#disable-envoy-s-access-logging} 编辑 `istio` 配置文件然后设置 `meshConfig.accessLogFile` 为 `""`。 diff --git a/content/zh/docs/tasks/observability/logs/otel-provider/index.md b/content/zh/docs/tasks/observability/logs/otel-provider/index.md index 80b94a6728..9b461249cb 100644 --- a/content/zh/docs/tasks/observability/logs/otel-provider/index.md +++ b/content/zh/docs/tasks/observability/logs/otel-provider/index.md @@ -20,7 +20,7 @@ test: yes {{< boilerplate start-otel-collector-service >}} -## 启用 Envoy 的访问日志记录{#enable-envoy-access-logging} +## 启用 Envoy 的访问日志记录 {#enable-envoy-access-logging} 要启用访问日志记录,可以使用 [Telemetry API](/zh/docs/tasks/observability/telemetry/)。 @@ -87,7 +87,7 @@ EOF 有关使用 Telemetry API 的更多信息,请参阅 [Telemetry API 概述](/zh/docs/tasks/observability/telemetry/)。 -### 使用网格配置 +### 使用网格配置 {#using-mesh-config} 如果您使用了 `IstioOperator` CR 来安装 Istio,请将以下字段添加到您的配置: @@ -112,7 +112,7 @@ spec: $ istioctl install -f {{< /text >}} -## 默认访问日志格式{#default-access-log-format} +## 默认访问日志格式 {#default-access-log-format} 如果 `accessLogFormat` 未被指定,Istio 将使用以下默认的访问日志格式: @@ -149,7 +149,7 @@ $ istioctl install -f | `%REQUESTED_SERVER_NAME%` | `-` | `outbound_.8000_._.httpbin.foo.svc.cluster.local` | `%ROUTE_NAME%` | `default` | `default` -## 测试访问日志{#test-access-log} +## 测试访问日志 {#test-access-log} 1. 将请求从 `sleep` 发送到 `httpbin`: @@ -178,10 +178,10 @@ $ istioctl install -f {{< /text >}} 请注意,与请求对应的消息分别出现在来源和目的地(即 `sleep` 和 `httpbin`)的 Istio 代理日志中。 -您可以在此日志中看到 HTTP 动作 (`GET`)、HTTP 路径 (`/status/418`)、响应码 (`418`) +您可以在此日志中看到 HTTP 动作(`GET`)、HTTP 路径(`/status/418`)、响应码(`418`) 和其他[请求相关的信息](https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#format-rules)。 -## 清理{#cleanup} +## 清理 {#cleanup} 关闭 [sleep]({{< github_tree >}}/samples/sleep) 和 [httpbin]({{< github_tree >}}/samples/httpbin) 服务: @@ -192,9 +192,10 @@ $ kubectl delete -f @samples/httpbin/httpbin.yaml@ $ kubectl delete -f @samples/open-telemetry/otel.yaml@ -n istio-system {{< /text >}} -### 禁用 Envoy 的访问日志记录{#disable-envoy-access-logging} +### 禁用 Envoy 的访问日志记录 {#disable-envoy-access-logging} -在您的 Istio 安装配置中移除 `meshConfig.extensionProviders` 和 `meshConfig.defaultProviders` 设置或设置为 `""`。 +在您的 Istio 安装配置中移除 `meshConfig.extensionProviders` 和 +`meshConfig.defaultProviders` 设置或设置为 `""`。 {{< tip >}} 如下例所示,将 `default` 替换为安装 Istio 时所用的配置文件名称。 diff --git a/content/zh/docs/tasks/observability/logs/telemetry-api/index.md b/content/zh/docs/tasks/observability/logs/telemetry-api/index.md index 0c9b876db0..daf471b089 100644 --- a/content/zh/docs/tasks/observability/logs/telemetry-api/index.md +++ b/content/zh/docs/tasks/observability/logs/telemetry-api/index.md @@ -8,13 +8,13 @@ test: yes --- Telemetry API 如今在 Istio 中作为核心 API 已经有一段时间了。 -之前用户必须在 Istio 的 `MeshConfig` 中配置遥测。 +之前用户必须在 Istio 的 `MeshConfig` 中配置 Telemetry。 {{< boilerplate before-you-begin-egress >}} {{< boilerplate start-httpbin-service >}} -## 安装{#installation} +## 安装 {#installation} 在本例中,我们将发送日志到 [Grafana Loki](https://grafana.com/oss/loki/),确保它已被安装。 @@ -24,7 +24,7 @@ $ kubectl apply -f @samples/addons/loki.yaml@ -n istio-system $ kubectl apply -f @samples/open-telemetry/loki/otel.yaml@ -n istio-system {{< /text >}} -## Telemetry API 入门{#get-started-with-telemetry-api} +## Telemetry API 入门 {#get-started-with-telemetry-api} 1. 启用访问日志记录 @@ -132,14 +132,14 @@ $ kubectl apply -f @samples/open-telemetry/loki/otel.yaml@ -n istio-system EOF {{< /text >}} - 有关更多信息,请参阅[使用赋值表达式](/zh/docs/tasks/observability/metrics/customize-metrics/#use-expressions-for-values) + 有关更多信息,请参阅[使用赋值表达式](/zh/docs/tasks/observability/metrics/customize-metrics/#use-expressions-for-values)。 -## 使用 OpenTelemetry 提供程序{#work-with-otel-provider} +## 使用 OpenTelemetry 提供程序 {#work-with-otel-provider} Istio 支持使用 [OpenTelemetry](https://opentelemetry.io/) 协议发送访问日志, 如[此处](/zh/docs/tasks/observability/logs/otel-provider)所述。 -## 清理{#cleanup} +## 清理 {#cleanup} 1. 移除所有 Telemetry API: