accesslog.proto 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. syntax = "proto3";
  2. package envoy.data.accesslog.v2;
  3. import "envoy/api/v2/core/address.proto";
  4. import "envoy/api/v2/core/base.proto";
  5. import "google/protobuf/any.proto";
  6. import "google/protobuf/duration.proto";
  7. import "google/protobuf/timestamp.proto";
  8. import "google/protobuf/wrappers.proto";
  9. import "udpa/annotations/status.proto";
  10. import "validate/validate.proto";
  11. option java_package = "io.envoyproxy.envoy.data.accesslog.v2";
  12. option java_outer_classname = "AccesslogProto";
  13. option java_multiple_files = true;
  14. option go_package = "github.com/envoyproxy/go-control-plane/envoy/data/accesslog/v2;accesslogv2";
  15. option (udpa.annotations.file_status).package_version_status = FROZEN;
  16. // [#protodoc-title: gRPC access logs]
  17. // Envoy access logs describe incoming interaction with Envoy over a fixed
  18. // period of time, and typically cover a single request/response exchange,
  19. // (e.g. HTTP), stream (e.g. over HTTP/gRPC), or proxied connection (e.g. TCP).
  20. // Access logs contain fields defined in protocol-specific protobuf messages.
  21. //
  22. // Except where explicitly declared otherwise, all fields describe
  23. // *downstream* interaction between Envoy and a connected client.
  24. // Fields describing *upstream* interaction will explicitly include ``upstream``
  25. // in their name.
  26. message TCPAccessLogEntry {
  27. // Common properties shared by all Envoy access logs.
  28. AccessLogCommon common_properties = 1;
  29. // Properties of the TCP connection.
  30. ConnectionProperties connection_properties = 2;
  31. }
  32. message HTTPAccessLogEntry {
  33. // HTTP version
  34. enum HTTPVersion {
  35. PROTOCOL_UNSPECIFIED = 0;
  36. HTTP10 = 1;
  37. HTTP11 = 2;
  38. HTTP2 = 3;
  39. HTTP3 = 4;
  40. }
  41. // Common properties shared by all Envoy access logs.
  42. AccessLogCommon common_properties = 1;
  43. HTTPVersion protocol_version = 2;
  44. // Description of the incoming HTTP request.
  45. HTTPRequestProperties request = 3;
  46. // Description of the outgoing HTTP response.
  47. HTTPResponseProperties response = 4;
  48. }
  49. // Defines fields for a connection
  50. message ConnectionProperties {
  51. // Number of bytes received from downstream.
  52. uint64 received_bytes = 1;
  53. // Number of bytes sent to downstream.
  54. uint64 sent_bytes = 2;
  55. }
  56. // Defines fields that are shared by all Envoy access logs.
  57. // [#next-free-field: 22]
  58. message AccessLogCommon {
  59. // [#not-implemented-hide:]
  60. // This field indicates the rate at which this log entry was sampled.
  61. // Valid range is (0.0, 1.0].
  62. double sample_rate = 1 [(validate.rules).double = {lte: 1.0 gt: 0.0}];
  63. // This field is the remote/origin address on which the request from the user was received.
  64. // Note: This may not be the physical peer. E.g, if the remote address is inferred from for
  65. // example the x-forwarder-for header, proxy protocol, etc.
  66. api.v2.core.Address downstream_remote_address = 2;
  67. // This field is the local/destination address on which the request from the user was received.
  68. api.v2.core.Address downstream_local_address = 3;
  69. // If the connection is secure,S this field will contain TLS properties.
  70. TLSProperties tls_properties = 4;
  71. // The time that Envoy started servicing this request. This is effectively the time that the first
  72. // downstream byte is received.
  73. google.protobuf.Timestamp start_time = 5;
  74. // Interval between the first downstream byte received and the last
  75. // downstream byte received (i.e. time it takes to receive a request).
  76. google.protobuf.Duration time_to_last_rx_byte = 6;
  77. // Interval between the first downstream byte received and the first upstream byte sent. There may
  78. // by considerable delta between *time_to_last_rx_byte* and this value due to filters.
  79. // Additionally, the same caveats apply as documented in *time_to_last_downstream_tx_byte* about
  80. // not accounting for kernel socket buffer time, etc.
  81. google.protobuf.Duration time_to_first_upstream_tx_byte = 7;
  82. // Interval between the first downstream byte received and the last upstream byte sent. There may
  83. // by considerable delta between *time_to_last_rx_byte* and this value due to filters.
  84. // Additionally, the same caveats apply as documented in *time_to_last_downstream_tx_byte* about
  85. // not accounting for kernel socket buffer time, etc.
  86. google.protobuf.Duration time_to_last_upstream_tx_byte = 8;
  87. // Interval between the first downstream byte received and the first upstream
  88. // byte received (i.e. time it takes to start receiving a response).
  89. google.protobuf.Duration time_to_first_upstream_rx_byte = 9;
  90. // Interval between the first downstream byte received and the last upstream
  91. // byte received (i.e. time it takes to receive a complete response).
  92. google.protobuf.Duration time_to_last_upstream_rx_byte = 10;
  93. // Interval between the first downstream byte received and the first downstream byte sent.
  94. // There may be a considerable delta between the *time_to_first_upstream_rx_byte* and this field
  95. // due to filters. Additionally, the same caveats apply as documented in
  96. // *time_to_last_downstream_tx_byte* about not accounting for kernel socket buffer time, etc.
  97. google.protobuf.Duration time_to_first_downstream_tx_byte = 11;
  98. // Interval between the first downstream byte received and the last downstream byte sent.
  99. // Depending on protocol, buffering, windowing, filters, etc. there may be a considerable delta
  100. // between *time_to_last_upstream_rx_byte* and this field. Note also that this is an approximate
  101. // time. In the current implementation it does not include kernel socket buffer time. In the
  102. // current implementation it also does not include send window buffering inside the HTTP/2 codec.
  103. // In the future it is likely that work will be done to make this duration more accurate.
  104. google.protobuf.Duration time_to_last_downstream_tx_byte = 12;
  105. // The upstream remote/destination address that handles this exchange. This does not include
  106. // retries.
  107. api.v2.core.Address upstream_remote_address = 13;
  108. // The upstream local/origin address that handles this exchange. This does not include retries.
  109. api.v2.core.Address upstream_local_address = 14;
  110. // The upstream cluster that *upstream_remote_address* belongs to.
  111. string upstream_cluster = 15;
  112. // Flags indicating occurrences during request/response processing.
  113. ResponseFlags response_flags = 16;
  114. // All metadata encountered during request processing, including endpoint
  115. // selection.
  116. //
  117. // This can be used to associate IDs attached to the various configurations
  118. // used to process this request with the access log entry. For example, a
  119. // route created from a higher level forwarding rule with some ID can place
  120. // that ID in this field and cross reference later. It can also be used to
  121. // determine if a canary endpoint was used or not.
  122. api.v2.core.Metadata metadata = 17;
  123. // If upstream connection failed due to transport socket (e.g. TLS handshake), provides the
  124. // failure reason from the transport socket. The format of this field depends on the configured
  125. // upstream transport socket. Common TLS failures are in
  126. // :ref:`TLS trouble shooting <arch_overview_ssl_trouble_shooting>`.
  127. string upstream_transport_failure_reason = 18;
  128. // The name of the route
  129. string route_name = 19;
  130. // This field is the downstream direct remote address on which the request from the user was
  131. // received. Note: This is always the physical peer, even if the remote address is inferred from
  132. // for example the x-forwarder-for header, proxy protocol, etc.
  133. api.v2.core.Address downstream_direct_remote_address = 20;
  134. // Map of filter state in stream info that have been configured to be logged. If the filter
  135. // state serialized to any message other than `google.protobuf.Any` it will be packed into
  136. // `google.protobuf.Any`.
  137. map<string, google.protobuf.Any> filter_state_objects = 21;
  138. }
  139. // Flags indicating occurrences during request/response processing.
  140. // [#next-free-field: 20]
  141. message ResponseFlags {
  142. message Unauthorized {
  143. // Reasons why the request was unauthorized
  144. enum Reason {
  145. REASON_UNSPECIFIED = 0;
  146. // The request was denied by the external authorization service.
  147. EXTERNAL_SERVICE = 1;
  148. }
  149. Reason reason = 1;
  150. }
  151. // Indicates local server healthcheck failed.
  152. bool failed_local_healthcheck = 1;
  153. // Indicates there was no healthy upstream.
  154. bool no_healthy_upstream = 2;
  155. // Indicates an there was an upstream request timeout.
  156. bool upstream_request_timeout = 3;
  157. // Indicates local codec level reset was sent on the stream.
  158. bool local_reset = 4;
  159. // Indicates remote codec level reset was received on the stream.
  160. bool upstream_remote_reset = 5;
  161. // Indicates there was a local reset by a connection pool due to an initial connection failure.
  162. bool upstream_connection_failure = 6;
  163. // Indicates the stream was reset due to an upstream connection termination.
  164. bool upstream_connection_termination = 7;
  165. // Indicates the stream was reset because of a resource overflow.
  166. bool upstream_overflow = 8;
  167. // Indicates no route was found for the request.
  168. bool no_route_found = 9;
  169. // Indicates that the request was delayed before proxying.
  170. bool delay_injected = 10;
  171. // Indicates that the request was aborted with an injected error code.
  172. bool fault_injected = 11;
  173. // Indicates that the request was rate-limited locally.
  174. bool rate_limited = 12;
  175. // Indicates if the request was deemed unauthorized and the reason for it.
  176. Unauthorized unauthorized_details = 13;
  177. // Indicates that the request was rejected because there was an error in rate limit service.
  178. bool rate_limit_service_error = 14;
  179. // Indicates the stream was reset due to a downstream connection termination.
  180. bool downstream_connection_termination = 15;
  181. // Indicates that the upstream retry limit was exceeded, resulting in a downstream error.
  182. bool upstream_retry_limit_exceeded = 16;
  183. // Indicates that the stream idle timeout was hit, resulting in a downstream 408.
  184. bool stream_idle_timeout = 17;
  185. // Indicates that the request was rejected because an envoy request header failed strict
  186. // validation.
  187. bool invalid_envoy_request_headers = 18;
  188. // Indicates there was an HTTP protocol error on the downstream request.
  189. bool downstream_protocol_error = 19;
  190. }
  191. // Properties of a negotiated TLS connection.
  192. // [#next-free-field: 7]
  193. message TLSProperties {
  194. enum TLSVersion {
  195. VERSION_UNSPECIFIED = 0;
  196. TLSv1 = 1;
  197. TLSv1_1 = 2;
  198. TLSv1_2 = 3;
  199. TLSv1_3 = 4;
  200. }
  201. message CertificateProperties {
  202. message SubjectAltName {
  203. oneof san {
  204. string uri = 1;
  205. // [#not-implemented-hide:]
  206. string dns = 2;
  207. }
  208. }
  209. // SANs present in the certificate.
  210. repeated SubjectAltName subject_alt_name = 1;
  211. // The subject field of the certificate.
  212. string subject = 2;
  213. }
  214. // Version of TLS that was negotiated.
  215. TLSVersion tls_version = 1;
  216. // TLS cipher suite negotiated during handshake. The value is a
  217. // four-digit hex code defined by the IANA TLS Cipher Suite Registry
  218. // (e.g. ``009C`` for ``TLS_RSA_WITH_AES_128_GCM_SHA256``).
  219. //
  220. // Here it is expressed as an integer.
  221. google.protobuf.UInt32Value tls_cipher_suite = 2;
  222. // SNI hostname from handshake.
  223. string tls_sni_hostname = 3;
  224. // Properties of the local certificate used to negotiate TLS.
  225. CertificateProperties local_certificate_properties = 4;
  226. // Properties of the peer certificate used to negotiate TLS.
  227. CertificateProperties peer_certificate_properties = 5;
  228. // The TLS session ID.
  229. string tls_session_id = 6;
  230. }
  231. // [#next-free-field: 14]
  232. message HTTPRequestProperties {
  233. // The request method (RFC 7231/2616).
  234. api.v2.core.RequestMethod request_method = 1 [(validate.rules).enum = {defined_only: true}];
  235. // The scheme portion of the incoming request URI.
  236. string scheme = 2;
  237. // HTTP/2 ``:authority`` or HTTP/1.1 ``Host`` header value.
  238. string authority = 3;
  239. // The port of the incoming request URI
  240. // (unused currently, as port is composed onto authority).
  241. google.protobuf.UInt32Value port = 4;
  242. // The path portion from the incoming request URI.
  243. string path = 5;
  244. // Value of the ``User-Agent`` request header.
  245. string user_agent = 6;
  246. // Value of the ``Referer`` request header.
  247. string referer = 7;
  248. // Value of the ``X-Forwarded-For`` request header.
  249. string forwarded_for = 8;
  250. // Value of the ``X-Request-Id`` request header
  251. //
  252. // This header is used by Envoy to uniquely identify a request.
  253. // It will be generated for all external requests and internal requests that
  254. // do not already have a request ID.
  255. string request_id = 9;
  256. // Value of the ``X-Envoy-Original-Path`` request header.
  257. string original_path = 10;
  258. // Size of the HTTP request headers in bytes.
  259. //
  260. // This value is captured from the OSI layer 7 perspective, i.e. it does not
  261. // include overhead from framing or encoding at other networking layers.
  262. uint64 request_headers_bytes = 11;
  263. // Size of the HTTP request body in bytes.
  264. //
  265. // This value is captured from the OSI layer 7 perspective, i.e. it does not
  266. // include overhead from framing or encoding at other networking layers.
  267. uint64 request_body_bytes = 12;
  268. // Map of additional headers that have been configured to be logged.
  269. map<string, string> request_headers = 13;
  270. }
  271. // [#next-free-field: 7]
  272. message HTTPResponseProperties {
  273. // The HTTP response code returned by Envoy.
  274. google.protobuf.UInt32Value response_code = 1;
  275. // Size of the HTTP response headers in bytes.
  276. //
  277. // This value is captured from the OSI layer 7 perspective, i.e. it does not
  278. // include overhead from framing or encoding at other networking layers.
  279. uint64 response_headers_bytes = 2;
  280. // Size of the HTTP response body in bytes.
  281. //
  282. // This value is captured from the OSI layer 7 perspective, i.e. it does not
  283. // include overhead from framing or encoding at other networking layers.
  284. uint64 response_body_bytes = 3;
  285. // Map of additional headers configured to be logged.
  286. map<string, string> response_headers = 4;
  287. // Map of trailers configured to be logged.
  288. map<string, string> response_trailers = 5;
  289. // The HTTP response code details.
  290. string response_code_details = 6;
  291. }