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 @ 00238028d51dd7e2a866e721a678dbc5cdbec996master-ci-test
parent
b852af49b7
commit
802971088f
7 changed files with 200 additions and 4 deletions
@ -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}]; |
||||||
|
} |
||||||
|
} |
@ -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…
Reference in new issue