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 <zuercher@gmail.com>

Mirrored from https://github.com/envoyproxy/envoy @ c7affbc223fae3a5dd104b8d6be4ea29af4042f6
master-ci-test
data-plane-api(CircleCI) 5 years ago
parent 4a179feb31
commit 57c34af198
  1. 16
      envoy/config/accesslog/v2/file.proto
  2. 16
      envoy/config/accesslog/v3alpha/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
// <config_access_log_format>` as well as a :ref:`default format
// <config_access_log_default_format>`.
oneof access_log_format {
// Access log :ref:`format string<config_access_log_format_strings>`
// Access log :ref:`format string<config_access_log_format_strings>`.
// Envoy supports :ref:`custom access log formats <config_access_log_format>` as well as a
// :ref:`default format <config_access_log_default_format>`.
string format = 2;
// Access log :ref:`format dictionary<config_access_log_format_dictionaries>`
// Access log :ref:`format dictionary<config_access_log_format_dictionaries>`. All values
// are rendered as strings.
google.protobuf.Struct json_format = 3;
// Access log :ref:`format dictionary<config_access_log_format_dictionaries>`. 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;
}
}

@ -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
// <config_access_log_format>` as well as a :ref:`default format
// <config_access_log_default_format>`.
oneof access_log_format {
// Access log :ref:`format string<config_access_log_format_strings>`
// Access log :ref:`format string<config_access_log_format_strings>`.
// Envoy supports :ref:`custom access log formats <config_access_log_format>` as well as a
// :ref:`default format <config_access_log_default_format>`.
string format = 2;
// Access log :ref:`format dictionary<config_access_log_format_dictionaries>`
// Access log :ref:`format dictionary<config_access_log_format_dictionaries>`. All values
// are rendered as strings.
google.protobuf.Struct json_format = 3;
// Access log :ref:`format dictionary<config_access_log_format_dictionaries>`. 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;
}
}

Loading…
Cancel
Save