diff --git a/envoy/config/accesslog/v4alpha/accesslog.proto b/envoy/config/accesslog/v4alpha/accesslog.proto index c5eb4d24..939d4df9 100644 --- a/envoy/config/accesslog/v4alpha/accesslog.proto +++ b/envoy/config/accesslog/v4alpha/accesslog.proto @@ -43,7 +43,7 @@ message AccessLog { // configurations include: // // #. "envoy.access_loggers.file": :ref:`FileAccessLog - // ` + // ` // #. "envoy.access_loggers.http_grpc": :ref:`HttpGrpcAccessLogConfig // ` // #. "envoy.access_loggers.tcp_grpc": :ref:`TcpGrpcAccessLogConfig diff --git a/envoy/config/core/v3/substitution_format_string.proto b/envoy/config/core/v3/substitution_format_string.proto new file mode 100644 index 00000000..5fe6c087 --- /dev/null +++ b/envoy/config/core/v3/substitution_format_string.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; + +package envoy.config.core.v3; + +import "google/protobuf/struct.proto"; + +import "udpa/annotations/status.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.config.core.v3"; +option java_outer_classname = "SubstitutionFormatStringProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Substitution format string] + +// Configuration to use multiple :ref:`command operators ` +// to generate a new string in either plain text or JSON format. +message SubstitutionFormatString { + oneof format { + option (validate.required) = true; + + // Specify a format with command operators to form a text string. + // Its details is described in :ref:`format string`. + // + // .. code-block:: + // + // text_format: %RESP_BODY%:%RESPONSE_CODE%:path=$REQ(:path)% + // + // The following plain text will be created: + // + // .. code-block:: + // + // upstream connect error:204:path=/foo + // + string text_format = 1 [(validate.rules).string = {min_bytes: 1}]; + + // Specify a format with command operators to form a JSON string. + // Its details is described in :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. + // + // .. code-block:: + // + // typed_json_format: + // status: %RESPONSE_CODE% + // message: %RESP_BODY% + // + // The following JSON object would be created: + // + // .. code-block:: json + // + // { + // "status": 500, + // "message": "My error message" + // } + // + google.protobuf.Struct json_format = 2 [(validate.rules).message = {required: true}]; + } +} diff --git a/envoy/config/core/v4alpha/substitution_format_string.proto b/envoy/config/core/v4alpha/substitution_format_string.proto new file mode 100644 index 00000000..d998ca1f --- /dev/null +++ b/envoy/config/core/v4alpha/substitution_format_string.proto @@ -0,0 +1,65 @@ +syntax = "proto3"; + +package envoy.config.core.v4alpha; + +import "google/protobuf/struct.proto"; + +import "udpa/annotations/status.proto"; +import "udpa/annotations/versioning.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.config.core.v4alpha"; +option java_outer_classname = "SubstitutionFormatStringProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = NEXT_MAJOR_VERSION_CANDIDATE; + +// [#protodoc-title: Substitution format string] + +// Configuration to use multiple :ref:`command operators ` +// to generate a new string in either plain text or JSON format. +message SubstitutionFormatString { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.core.v3.SubstitutionFormatString"; + + oneof format { + option (validate.required) = true; + + // Specify a format with command operators to form a text string. + // Its details is described in :ref:`format string`. + // + // .. code-block:: + // + // text_format: %RESP_BODY%:%RESPONSE_CODE%:path=$REQ(:path)% + // + // The following plain text will be created: + // + // .. code-block:: + // + // upstream connect error:204:path=/foo + // + string text_format = 1 [(validate.rules).string = {min_bytes: 1}]; + + // Specify a format with command operators to form a JSON string. + // Its details is described in :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. + // + // .. code-block:: + // + // typed_json_format: + // status: %RESPONSE_CODE% + // message: %RESP_BODY% + // + // The following JSON object would be created: + // + // .. code-block:: json + // + // { + // "status": 500, + // "message": "My error message" + // } + // + google.protobuf.Struct json_format = 2 [(validate.rules).message = {required: true}]; + } +} diff --git a/envoy/extensions/access_loggers/file/v3/BUILD b/envoy/extensions/access_loggers/file/v3/BUILD index db752e85..3edacd3a 100644 --- a/envoy/extensions/access_loggers/file/v3/BUILD +++ b/envoy/extensions/access_loggers/file/v3/BUILD @@ -7,6 +7,7 @@ licenses(["notice"]) # Apache 2 api_proto_package( deps = [ "//envoy/config/accesslog/v2:pkg", + "//envoy/config/core/v3:pkg", "@com_github_cncf_udpa//udpa/annotations:pkg", ], ) diff --git a/envoy/extensions/access_loggers/file/v3/file.proto b/envoy/extensions/access_loggers/file/v3/file.proto index f3c9c0a1..de33623c 100644 --- a/envoy/extensions/access_loggers/file/v3/file.proto +++ b/envoy/extensions/access_loggers/file/v3/file.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package envoy.extensions.access_loggers.file.v3; +import "envoy/config/core/v3/substitution_format_string.proto"; + import "google/protobuf/struct.proto"; import "udpa/annotations/status.proto"; @@ -19,6 +21,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE; // Custom configuration for an :ref:`AccessLog ` // that writes log entries directly to a file. Configures the built-in *envoy.access_loggers.file* // AccessLog. +// [#next-free-field: 6] message FileAccessLog { option (udpa.annotations.versioning).previous_message_type = "envoy.config.accesslog.v2.FileAccessLog"; @@ -30,16 +33,27 @@ message FileAccessLog { // Access log :ref:`format string`. // Envoy supports :ref:`custom access log formats ` as well as a // :ref:`default format `. - string format = 2; + // This field is deprecated. + // Please use :ref:`log_format `. + string format = 2 [deprecated = true]; // Access log :ref:`format dictionary`. All values // are rendered as strings. - google.protobuf.Struct json_format = 3; + // This field is deprecated. + // Please use :ref:`log_format `. + google.protobuf.Struct json_format = 3 [deprecated = true]; // 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; + // This field is deprecated. + // Please use :ref:`log_format `. + google.protobuf.Struct typed_json_format = 4 [deprecated = true]; + + // Configuration to form access log data and format. + // If not specified, use :ref:`default format `. + config.core.v3.SubstitutionFormatString log_format = 5 + [(validate.rules).message = {required: true}]; } } diff --git a/envoy/extensions/access_loggers/file/v4alpha/BUILD b/envoy/extensions/access_loggers/file/v4alpha/BUILD new file mode 100644 index 00000000..ba8c3042 --- /dev/null +++ b/envoy/extensions/access_loggers/file/v4alpha/BUILD @@ -0,0 +1,13 @@ +# DO NOT EDIT. This file is generated by tools/proto_sync.py. + +load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") + +licenses(["notice"]) # Apache 2 + +api_proto_package( + deps = [ + "//envoy/config/core/v4alpha:pkg", + "//envoy/extensions/access_loggers/file/v3:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], +) diff --git a/envoy/extensions/access_loggers/file/v4alpha/file.proto b/envoy/extensions/access_loggers/file/v4alpha/file.proto new file mode 100644 index 00000000..fa2ec9a5 --- /dev/null +++ b/envoy/extensions/access_loggers/file/v4alpha/file.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; + +package envoy.extensions.access_loggers.file.v4alpha; + +import "envoy/config/core/v4alpha/substitution_format_string.proto"; + +import "google/protobuf/struct.proto"; + +import "udpa/annotations/status.proto"; +import "udpa/annotations/versioning.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.access_loggers.file.v4alpha"; +option java_outer_classname = "FileProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = NEXT_MAJOR_VERSION_CANDIDATE; + +// [#protodoc-title: File access log] +// [#extension: envoy.access_loggers.file] + +// Custom configuration for an :ref:`AccessLog ` +// that writes log entries directly to a file. Configures the built-in *envoy.access_loggers.file* +// AccessLog. +// [#next-free-field: 6] +message FileAccessLog { + option (udpa.annotations.versioning).previous_message_type = + "envoy.extensions.access_loggers.file.v3.FileAccessLog"; + + reserved 2, 3, 4; + + reserved "format", "json_format", "typed_json_format"; + + // A path to a local file to which to write the access log entries. + string path = 1 [(validate.rules).string = {min_bytes: 1}]; + + oneof access_log_format { + // Configuration to form access log data and format. + // If not specified, use :ref:`default format `. + config.core.v4alpha.SubstitutionFormatString log_format = 5 + [(validate.rules).message = {required: true}]; + } +}