Move access_log_format out of FileAccessLogger to be shared (#11125)

Signed-off-by: Wayne Zhang <qiwzhang@google.com>

Mirrored from https://github.com/envoyproxy/envoy @ 00238028d51dd7e2a866e721a678dbc5cdbec996
master-ci-test
data-plane-api(CircleCI) 5 years ago
parent b852af49b7
commit 802971088f
  1. 2
      envoy/config/accesslog/v4alpha/accesslog.proto
  2. 61
      envoy/config/core/v3/substitution_format_string.proto
  3. 65
      envoy/config/core/v4alpha/substitution_format_string.proto
  4. 1
      envoy/extensions/access_loggers/file/v3/BUILD
  5. 20
      envoy/extensions/access_loggers/file/v3/file.proto
  6. 13
      envoy/extensions/access_loggers/file/v4alpha/BUILD
  7. 42
      envoy/extensions/access_loggers/file/v4alpha/file.proto

@ -43,7 +43,7 @@ message AccessLog {
// configurations include: // configurations include:
// //
// #. "envoy.access_loggers.file": :ref:`FileAccessLog // #. "envoy.access_loggers.file": :ref:`FileAccessLog
// <envoy_api_msg_extensions.access_loggers.file.v3.FileAccessLog>` // <envoy_api_msg_extensions.access_loggers.file.v4alpha.FileAccessLog>`
// #. "envoy.access_loggers.http_grpc": :ref:`HttpGrpcAccessLogConfig // #. "envoy.access_loggers.http_grpc": :ref:`HttpGrpcAccessLogConfig
// <envoy_api_msg_extensions.access_loggers.grpc.v3.HttpGrpcAccessLogConfig>` // <envoy_api_msg_extensions.access_loggers.grpc.v3.HttpGrpcAccessLogConfig>`
// #. "envoy.access_loggers.tcp_grpc": :ref:`TcpGrpcAccessLogConfig // #. "envoy.access_loggers.tcp_grpc": :ref:`TcpGrpcAccessLogConfig

@ -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 <config_access_log_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<config_access_log_format_strings>`.
//
// .. 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<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.
//
// .. 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}];
}
}

@ -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 <config_access_log_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<config_access_log_format_strings>`.
//
// .. 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<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.
//
// .. 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}];
}
}

@ -7,6 +7,7 @@ licenses(["notice"]) # Apache 2
api_proto_package( api_proto_package(
deps = [ deps = [
"//envoy/config/accesslog/v2:pkg", "//envoy/config/accesslog/v2:pkg",
"//envoy/config/core/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg", "@com_github_cncf_udpa//udpa/annotations:pkg",
], ],
) )

@ -2,6 +2,8 @@ syntax = "proto3";
package envoy.extensions.access_loggers.file.v3; package envoy.extensions.access_loggers.file.v3;
import "envoy/config/core/v3/substitution_format_string.proto";
import "google/protobuf/struct.proto"; import "google/protobuf/struct.proto";
import "udpa/annotations/status.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 <envoy_api_msg_config.accesslog.v3.AccessLog>` // Custom configuration for an :ref:`AccessLog <envoy_api_msg_config.accesslog.v3.AccessLog>`
// that writes log entries directly to a file. Configures the built-in *envoy.access_loggers.file* // that writes log entries directly to a file. Configures the built-in *envoy.access_loggers.file*
// AccessLog. // AccessLog.
// [#next-free-field: 6]
message FileAccessLog { message FileAccessLog {
option (udpa.annotations.versioning).previous_message_type = option (udpa.annotations.versioning).previous_message_type =
"envoy.config.accesslog.v2.FileAccessLog"; "envoy.config.accesslog.v2.FileAccessLog";
@ -30,16 +33,27 @@ message FileAccessLog {
// 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 // Envoy supports :ref:`custom access log formats <config_access_log_format>` as well as a
// :ref:`default format <config_access_log_default_format>`. // :ref:`default format <config_access_log_default_format>`.
string format = 2; // This field is deprecated.
// Please use :ref:`log_format <envoy_v3_api_field_extensions.access_loggers.file.v3.FileAccessLog.log_format>`.
string format = 2 [deprecated = true];
// Access log :ref:`format dictionary<config_access_log_format_dictionaries>`. All values // Access log :ref:`format dictionary<config_access_log_format_dictionaries>`. All values
// are rendered as strings. // are rendered as strings.
google.protobuf.Struct json_format = 3; // This field is deprecated.
// Please use :ref:`log_format <envoy_v3_api_field_extensions.access_loggers.file.v3.FileAccessLog.log_format>`.
google.protobuf.Struct json_format = 3 [deprecated = true];
// Access log :ref:`format dictionary<config_access_log_format_dictionaries>`. Values are // 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 // 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 // be produced by some command operators (e.g.FILTER_STATE or DYNAMIC_METADATA). See the
// documentation for a specific command operator for details. // documentation for a specific command operator for details.
google.protobuf.Struct typed_json_format = 4; // This field is deprecated.
// Please use :ref:`log_format <envoy_v3_api_field_extensions.access_loggers.file.v3.FileAccessLog.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_access_log_default_format>`.
config.core.v3.SubstitutionFormatString log_format = 5
[(validate.rules).message = {required: true}];
} }
} }

@ -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",
],
)

@ -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 <envoy_api_msg_config.accesslog.v4alpha.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_access_log_default_format>`.
config.core.v4alpha.SubstitutionFormatString log_format = 5
[(validate.rules).message = {required: true}];
}
}
Loading…
Cancel
Save