accesslog.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. syntax = "proto3";
  2. package envoy.config.accesslog.v3;
  3. import "envoy/config/core/v3/base.proto";
  4. import "envoy/config/route/v3/route_components.proto";
  5. import "envoy/type/matcher/v3/metadata.proto";
  6. import "envoy/type/v3/percent.proto";
  7. import "google/protobuf/any.proto";
  8. import "google/protobuf/wrappers.proto";
  9. import "udpa/annotations/status.proto";
  10. import "udpa/annotations/versioning.proto";
  11. import "validate/validate.proto";
  12. option java_package = "io.envoyproxy.envoy.config.accesslog.v3";
  13. option java_outer_classname = "AccesslogProto";
  14. option java_multiple_files = true;
  15. option go_package = "github.com/envoyproxy/go-control-plane/envoy/config/accesslog/v3;accesslogv3";
  16. option (udpa.annotations.file_status).package_version_status = ACTIVE;
  17. // [#protodoc-title: Common access log types]
  18. message AccessLog {
  19. option (udpa.annotations.versioning).previous_message_type =
  20. "envoy.config.filter.accesslog.v2.AccessLog";
  21. reserved 3;
  22. reserved "config";
  23. // The name of the access log extension to instantiate.
  24. // The name must match one of the compiled in loggers.
  25. // See the :ref:`extensions listed in typed_config below <extension_category_envoy.access_loggers>` for the default list of available loggers.
  26. string name = 1;
  27. // Filter which is used to determine if the access log needs to be written.
  28. AccessLogFilter filter = 2;
  29. // Custom configuration that must be set according to the access logger extension being instantiated.
  30. // [#extension-category: envoy.access_loggers]
  31. oneof config_type {
  32. google.protobuf.Any typed_config = 4;
  33. }
  34. }
  35. // [#next-free-field: 13]
  36. message AccessLogFilter {
  37. option (udpa.annotations.versioning).previous_message_type =
  38. "envoy.config.filter.accesslog.v2.AccessLogFilter";
  39. oneof filter_specifier {
  40. option (validate.required) = true;
  41. // Status code filter.
  42. StatusCodeFilter status_code_filter = 1;
  43. // Duration filter.
  44. DurationFilter duration_filter = 2;
  45. // Not health check filter.
  46. NotHealthCheckFilter not_health_check_filter = 3;
  47. // Traceable filter.
  48. TraceableFilter traceable_filter = 4;
  49. // Runtime filter.
  50. RuntimeFilter runtime_filter = 5;
  51. // And filter.
  52. AndFilter and_filter = 6;
  53. // Or filter.
  54. OrFilter or_filter = 7;
  55. // Header filter.
  56. HeaderFilter header_filter = 8;
  57. // Response flag filter.
  58. ResponseFlagFilter response_flag_filter = 9;
  59. // gRPC status filter.
  60. GrpcStatusFilter grpc_status_filter = 10;
  61. // Extension filter.
  62. // [#extension-category: envoy.access_loggers.extension_filters]
  63. ExtensionFilter extension_filter = 11;
  64. // Metadata Filter
  65. MetadataFilter metadata_filter = 12;
  66. }
  67. }
  68. // Filter on an integer comparison.
  69. message ComparisonFilter {
  70. option (udpa.annotations.versioning).previous_message_type =
  71. "envoy.config.filter.accesslog.v2.ComparisonFilter";
  72. enum Op {
  73. // =
  74. EQ = 0;
  75. // >=
  76. GE = 1;
  77. // <=
  78. LE = 2;
  79. }
  80. // Comparison operator.
  81. Op op = 1 [(validate.rules).enum = {defined_only: true}];
  82. // Value to compare against.
  83. core.v3.RuntimeUInt32 value = 2;
  84. }
  85. // Filters on HTTP response/status code.
  86. message StatusCodeFilter {
  87. option (udpa.annotations.versioning).previous_message_type =
  88. "envoy.config.filter.accesslog.v2.StatusCodeFilter";
  89. // Comparison.
  90. ComparisonFilter comparison = 1 [(validate.rules).message = {required: true}];
  91. }
  92. // Filters on total request duration in milliseconds.
  93. message DurationFilter {
  94. option (udpa.annotations.versioning).previous_message_type =
  95. "envoy.config.filter.accesslog.v2.DurationFilter";
  96. // Comparison.
  97. ComparisonFilter comparison = 1 [(validate.rules).message = {required: true}];
  98. }
  99. // Filters for requests that are not health check requests. A health check
  100. // request is marked by the health check filter.
  101. message NotHealthCheckFilter {
  102. option (udpa.annotations.versioning).previous_message_type =
  103. "envoy.config.filter.accesslog.v2.NotHealthCheckFilter";
  104. }
  105. // Filters for requests that are traceable. See the tracing overview for more
  106. // information on how a request becomes traceable.
  107. message TraceableFilter {
  108. option (udpa.annotations.versioning).previous_message_type =
  109. "envoy.config.filter.accesslog.v2.TraceableFilter";
  110. }
  111. // Filters for random sampling of requests.
  112. message RuntimeFilter {
  113. option (udpa.annotations.versioning).previous_message_type =
  114. "envoy.config.filter.accesslog.v2.RuntimeFilter";
  115. // Runtime key to get an optional overridden numerator for use in the
  116. // *percent_sampled* field. If found in runtime, this value will replace the
  117. // default numerator.
  118. string runtime_key = 1 [(validate.rules).string = {min_len: 1}];
  119. // The default sampling percentage. If not specified, defaults to 0% with
  120. // denominator of 100.
  121. type.v3.FractionalPercent percent_sampled = 2;
  122. // By default, sampling pivots on the header
  123. // :ref:`x-request-id<config_http_conn_man_headers_x-request-id>` being
  124. // present. If :ref:`x-request-id<config_http_conn_man_headers_x-request-id>`
  125. // is present, the filter will consistently sample across multiple hosts based
  126. // on the runtime key value and the value extracted from
  127. // :ref:`x-request-id<config_http_conn_man_headers_x-request-id>`. If it is
  128. // missing, or *use_independent_randomness* is set to true, the filter will
  129. // randomly sample based on the runtime key value alone.
  130. // *use_independent_randomness* can be used for logging kill switches within
  131. // complex nested :ref:`AndFilter
  132. // <envoy_v3_api_msg_config.accesslog.v3.AndFilter>` and :ref:`OrFilter
  133. // <envoy_v3_api_msg_config.accesslog.v3.OrFilter>` blocks that are easier to
  134. // reason about from a probability perspective (i.e., setting to true will
  135. // cause the filter to behave like an independent random variable when
  136. // composed within logical operator filters).
  137. bool use_independent_randomness = 3;
  138. }
  139. // Performs a logical “and” operation on the result of each filter in filters.
  140. // Filters are evaluated sequentially and if one of them returns false, the
  141. // filter returns false immediately.
  142. message AndFilter {
  143. option (udpa.annotations.versioning).previous_message_type =
  144. "envoy.config.filter.accesslog.v2.AndFilter";
  145. repeated AccessLogFilter filters = 1 [(validate.rules).repeated = {min_items: 2}];
  146. }
  147. // Performs a logical “or” operation on the result of each individual filter.
  148. // Filters are evaluated sequentially and if one of them returns true, the
  149. // filter returns true immediately.
  150. message OrFilter {
  151. option (udpa.annotations.versioning).previous_message_type =
  152. "envoy.config.filter.accesslog.v2.OrFilter";
  153. repeated AccessLogFilter filters = 2 [(validate.rules).repeated = {min_items: 2}];
  154. }
  155. // Filters requests based on the presence or value of a request header.
  156. message HeaderFilter {
  157. option (udpa.annotations.versioning).previous_message_type =
  158. "envoy.config.filter.accesslog.v2.HeaderFilter";
  159. // Only requests with a header which matches the specified HeaderMatcher will
  160. // pass the filter check.
  161. route.v3.HeaderMatcher header = 1 [(validate.rules).message = {required: true}];
  162. }
  163. // Filters requests that received responses with an Envoy response flag set.
  164. // A list of the response flags can be found
  165. // in the access log formatter
  166. // :ref:`documentation<config_access_log_format_response_flags>`.
  167. message ResponseFlagFilter {
  168. option (udpa.annotations.versioning).previous_message_type =
  169. "envoy.config.filter.accesslog.v2.ResponseFlagFilter";
  170. // Only responses with the any of the flags listed in this field will be
  171. // logged. This field is optional. If it is not specified, then any response
  172. // flag will pass the filter check.
  173. repeated string flags = 1 [(validate.rules).repeated = {
  174. items {
  175. string {
  176. in: "LH"
  177. in: "UH"
  178. in: "UT"
  179. in: "LR"
  180. in: "UR"
  181. in: "UF"
  182. in: "UC"
  183. in: "UO"
  184. in: "NR"
  185. in: "DI"
  186. in: "FI"
  187. in: "RL"
  188. in: "UAEX"
  189. in: "RLSE"
  190. in: "DC"
  191. in: "URX"
  192. in: "SI"
  193. in: "IH"
  194. in: "DPE"
  195. in: "UMSDR"
  196. in: "RFCF"
  197. in: "NFCF"
  198. in: "DT"
  199. in: "UPE"
  200. in: "NC"
  201. in: "OM"
  202. }
  203. }
  204. }];
  205. }
  206. // Filters gRPC requests based on their response status. If a gRPC status is not
  207. // provided, the filter will infer the status from the HTTP status code.
  208. message GrpcStatusFilter {
  209. option (udpa.annotations.versioning).previous_message_type =
  210. "envoy.config.filter.accesslog.v2.GrpcStatusFilter";
  211. enum Status {
  212. OK = 0;
  213. CANCELED = 1;
  214. UNKNOWN = 2;
  215. INVALID_ARGUMENT = 3;
  216. DEADLINE_EXCEEDED = 4;
  217. NOT_FOUND = 5;
  218. ALREADY_EXISTS = 6;
  219. PERMISSION_DENIED = 7;
  220. RESOURCE_EXHAUSTED = 8;
  221. FAILED_PRECONDITION = 9;
  222. ABORTED = 10;
  223. OUT_OF_RANGE = 11;
  224. UNIMPLEMENTED = 12;
  225. INTERNAL = 13;
  226. UNAVAILABLE = 14;
  227. DATA_LOSS = 15;
  228. UNAUTHENTICATED = 16;
  229. }
  230. // Logs only responses that have any one of the gRPC statuses in this field.
  231. repeated Status statuses = 1 [(validate.rules).repeated = {items {enum {defined_only: true}}}];
  232. // If included and set to true, the filter will instead block all responses
  233. // with a gRPC status or inferred gRPC status enumerated in statuses, and
  234. // allow all other responses.
  235. bool exclude = 2;
  236. }
  237. // Filters based on matching dynamic metadata.
  238. // If the matcher path and key correspond to an existing key in dynamic
  239. // metadata, the request is logged only if the matcher value is equal to the
  240. // metadata value. If the matcher path and key *do not* correspond to an
  241. // existing key in dynamic metadata, the request is logged only if
  242. // match_if_key_not_found is "true" or unset.
  243. message MetadataFilter {
  244. option (udpa.annotations.versioning).previous_message_type =
  245. "envoy.config.filter.accesslog.v2.MetadataFilter";
  246. // Matcher to check metadata for specified value. For example, to match on the
  247. // access_log_hint metadata, set the filter to "envoy.common" and the path to
  248. // "access_log_hint", and the value to "true".
  249. type.matcher.v3.MetadataMatcher matcher = 1;
  250. // Default result if the key does not exist in dynamic metadata: if unset or
  251. // true, then log; if false, then don't log.
  252. google.protobuf.BoolValue match_if_key_not_found = 2;
  253. }
  254. // Extension filter is statically registered at runtime.
  255. message ExtensionFilter {
  256. option (udpa.annotations.versioning).previous_message_type =
  257. "envoy.config.filter.accesslog.v2.ExtensionFilter";
  258. reserved 2;
  259. reserved "config";
  260. // The name of the filter implementation to instantiate. The name must
  261. // match a statically registered filter.
  262. string name = 1;
  263. // Custom configuration that depends on the filter being instantiated.
  264. oneof config_type {
  265. google.protobuf.Any typed_config = 3;
  266. }
  267. }