From 57c34af1988cbd23011b81502616a491731cb00e Mon Sep 17 00:00:00 2001 From: "data-plane-api(CircleCI)" Date: Thu, 5 Dec 2019 06:22:42 +0000 Subject: [PATCH] access_log: add ability to generate JSON access logs preserving data types (#9043) * access_log: add ability to generate JSON access logs preserving data types Using the new typed JSON format mode, numeric values (e.g. request duration, response codes, bytes sent, etc) are emitted as json numbers instead of as json strings. In addition, dynamic metadata and filter state are emitted as nested structs and lists where appropriate. Risk Level: medium for users of json logs Testing: unit tests Doc Changes: included Release Notes: included Fixes: #8374 Signed-off-by: Stephan Zuercher Mirrored from https://github.com/envoyproxy/envoy @ c7affbc223fae3a5dd104b8d6be4ea29af4042f6 --- envoy/config/accesslog/v2/file.proto | 16 +++++++++++----- envoy/config/accesslog/v3alpha/file.proto | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/envoy/config/accesslog/v2/file.proto b/envoy/config/accesslog/v2/file.proto index 16a49563..ec8a33e7 100644 --- a/envoy/config/accesslog/v2/file.proto +++ b/envoy/config/accesslog/v2/file.proto @@ -20,14 +20,20 @@ message FileAccessLog { // A path to a local file to which to write the access log entries. string path = 1 [(validate.rules).string = {min_bytes: 1}]; - // Access log format. Envoy supports :ref:`custom access log formats - // ` as well as a :ref:`default format - // `. oneof access_log_format { - // Access log :ref:`format string` + // Access log :ref:`format string`. + // Envoy supports :ref:`custom access log formats ` as well as a + // :ref:`default format `. string format = 2; - // Access log :ref:`format dictionary` + // Access log :ref:`format dictionary`. All values + // are rendered as strings. google.protobuf.Struct json_format = 3; + + // Access log :ref:`format dictionary`. Values are + // rendered as strings, numbers, or boolean values as appropriate. Nested JSON objects may + // be produced by some command operators (e.g.FILTER_STATE or DYNAMIC_METADATA). See the + // documentation for a specific command operator for details. + google.protobuf.Struct typed_json_format = 4; } } diff --git a/envoy/config/accesslog/v3alpha/file.proto b/envoy/config/accesslog/v3alpha/file.proto index 1bf81260..b8fc7fd0 100644 --- a/envoy/config/accesslog/v3alpha/file.proto +++ b/envoy/config/accesslog/v3alpha/file.proto @@ -25,14 +25,20 @@ message FileAccessLog { // A path to a local file to which to write the access log entries. string path = 1 [(validate.rules).string = {min_bytes: 1}]; - // Access log format. Envoy supports :ref:`custom access log formats - // ` as well as a :ref:`default format - // `. oneof access_log_format { - // Access log :ref:`format string` + // Access log :ref:`format string`. + // Envoy supports :ref:`custom access log formats ` as well as a + // :ref:`default format `. string format = 2; - // Access log :ref:`format dictionary` + // Access log :ref:`format dictionary`. All values + // are rendered as strings. google.protobuf.Struct json_format = 3; + + // Access log :ref:`format dictionary`. Values are + // rendered as strings, numbers, or boolean values as appropriate. Nested JSON objects may + // be produced by some command operators (e.g.FILTER_STATE or DYNAMIC_METADATA). See the + // documentation for a specific command operator for details. + google.protobuf.Struct typed_json_format = 4; } }