常见访问日志类型

Envoy访问日志记录的是在一段固定的时间内通过Envoy进行入站的交互,典型场景包括单个请求/响应交互(例如HTTP),流(例如通过HTTP 2/gRPC)或连接代理(例如TCP等)。访问日志包含协议指定的protobuf消息中定义的字段。

除非另有明确声明,否则所有字段都描述Envoy与连接的客户端之间的下游交互。描述上游交互的字段将在其名称中明确包含上游。

filter.accesslog.AccessLog

filter.accesslog.AccessLog proto

  1. {
  2. "name": "...",
  3. "filter": "{...}",
  4. "config": "{...}"
  5. }
  • name

    (string) 要实例化的访问日志实现的名称。 该名称必须与静态注册的访问日志匹配。当前的内置记录器为:1)“envoy.file_access_log”

  • filter

    (filter.accesslog.AccessLogFilter) 在写入访问日志时需要使用的过滤器。

  • config

    (Struct) 依赖实例化访问日志的自定义配置。内置的配置包括:1)“envoy.file_access_log”:FileAccessLog

filter.accesslog.AccessLogFilter

filter.accesslog.AccessLogFilter proto

  1. {
  2. "status_code_filter": "{...}",
  3. "duration_filter": "{...}",
  4. "not_health_check_filter": "{...}",
  5. "traceable_filter": "{...}",
  6. "runtime_filter": "{...}",
  7. "and_filter": "{...}",
  8. "or_filter": "{...}"
  9. }

注意:必须正确设置status_code_filterduration_filternot_health_check_filtertraceable_filterruntime_filterand_filteror_filter其中一个。

filter.accesslog.ComparisonFilter

filter.accesslog.ComparisonFilter proto

整数比较过滤器。

  1. {
  2. "op": "...",
  3. "value": "{...}"
  4. }

filter.accesslog.ComparisonFilter.Op (Enum)

filter.accesslog.ComparisonFilter.Op proto

  • EQ

    (DEFAULT) 相等=

  • GE

    大于等于>=

filter.accesslog.StatusCodeFilter

filter.accesslog.StatusCodeFilter proto

HTTP响应/状态代码的过滤器。

  1. {
  2. "comparison": "{...}"
  3. }

filter.accesslog.DurationFilter

filter.accesslog.DurationFilter proto

请求持续总时间,以毫秒为单位过滤。

  1. {
  2. "comparison": "{...}"
  3. }

filter.accesslog.NotHealthCheckFilter

filter.accesslog.NotHealthCheckFilter proto

筛选不健康检查请求。由健康检查过滤器标记。

  1. {}

filter.accesslog.TraceableFilter

filter.accesslog.TraceableFilter proto

筛选可追踪的请求。请参阅跟踪概述,以获取有关请求如何可跟踪的更多信息。

  1. {}

filter.accesslog.RuntimeFilter

filter.accesslog.RuntimeFilter proto

过滤器用于随机抽样请求。在x-request-id头部存在的情况下采样抽取。如果存在x-request-id,则过滤器将根据运行时Key/value和从x-request-id提取值并在多个主机上持续采样。如果缺失,过滤器将根据运行时Key/value随机抽样。

  1. {
  2. "runtime_key": "..."
  3. }
  • runtime_key

    (string, REQUIRED) 运行时key,以获取要采样的请求的百分比。此运行时值控制在0-100范围内,默认为0。

filter.accesslog.AndFilter

filter.accesslog.AndFilter proto

对过滤器中每个过滤器的结果执行逻辑“和”运算。过滤器将按顺序进行评估,如果其中一个返回false,则过滤器立即返回false。

  1. {
  2. "filters": []
  3. }

filter.accesslog.OrFilter

filter.accesslog.OrFilter proto

对每个单独的过滤器的结果执行逻辑“或”操作。过滤器将按顺序进行评估,如果其中一个返回true,则过滤器立即返回true。

  1. {
  2. "filters": []
  3. }

filter.accesslog.FileAccessLog

filter.accesslog.FileAccessLog proto

将日志条目直接写入文件的AccessLog的自定义配置。内置配置为envoy.file_access_log AccessLog

  1. {
  2. "path": "...",
  3. "format": "..."
  4. }
  • path

    (string, REQUIRED) 要写入访问日志条目的本地文件的路径。

  • format

    (string) 访问日志的格式。Envoy支持自定义访问日志格式以及默认格式。

返回