From 3f08c922a3726a800734ba68705410558c32aaee Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Tue, 12 Dec 2017 10:09:30 -0800 Subject: [PATCH] access log: gRPC service config updates (#338) Signed-off-by: Matt Klein --- api/filter/accesslog/accesslog.proto | 40 ++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/api/filter/accesslog/accesslog.proto b/api/filter/accesslog/accesslog.proto index 8d578cd0..07ba0094 100644 --- a/api/filter/accesslog/accesslog.proto +++ b/api/filter/accesslog/accesslog.proto @@ -365,17 +365,39 @@ message FileAccessLog { string format = 2; } -// Configuration for the built-in "envoy.grpc_access_log" access log type. +// Configuration for the built-in *envoy.tcp_grpc_access_log* type. This configuration will +// populate *StreamAccessLogsMessage.tcp_logs*. // [#not-implemented-hide:] -message AccessLogServiceConfig { +// [#comment:TODO(mattklein123): Block type in non-tcp proxy cases?] +message TcpGrpcAccessLogConfig { + CommonGrpcAccessLogConfig common_config = 1 [(validate.rules).message.required = true]; +} + +// Configuration for the built-in *envoy.http_grpc_access_log* type. This configuration will +// populate *StreamAccessLogsMessage.http_logs*. +// [#not-implemented-hide:] +// [#comment:TODO(mattklein123): Block type in non-http/router proxy cases?] +message HttpGrpcAccessLogConfig { + CommonGrpcAccessLogConfig common_config = 1 [(validate.rules).message.required = true]; + + // Additional request headers to log in *HTTPRequestProperties.request_headers*. + repeated string additional_request_headers_to_log = 2; + + // Additional response headers to log in *HTTPResponseProperties.response_headers*. + repeated string additional_response_headers_to_log = 3; +} + +// Common configuration for gRPC access logs. +// [#not-implemented-hide:] +message CommonGrpcAccessLogConfig { // The friendly name of the access log to be returned in StreamAccessLogsMessage.Identifier. This // allows the access log server to differentiate between different access logs coming from the // same Envoy. - string log_name = 1; + string log_name = 1 [(validate.rules).string.min_bytes = 1]; // The name of the upstream cluster that hosts the access log service. The cluster must be // configured in the cluster manager. - string cluster_name = 2; + string cluster_name = 2 [(validate.rules).string.min_bytes = 1]; } // [#proto-status: experimental] @@ -385,10 +407,10 @@ message AccessLogServiceConfig { message StreamAccessLogsMessage { message Identifier { // The node sending the access log messages over the stream. - Node node = 1; + Node node = 1 [(validate.rules).message.required = true]; // The friendly name of the log configured in AccessLogServiceConfig. - string log_name = 2; + string log_name = 2 [(validate.rules).string.min_bytes = 1]; } // Identifier data that will only be sent in the first message on the stream. This is effectively @@ -397,17 +419,19 @@ message StreamAccessLogsMessage { // Wrapper for batches of HTTP access log entries. message HTTPAccessLogEntries { - repeated HTTPAccessLogEntry log_entry = 1; + repeated HTTPAccessLogEntry log_entry = 1 [(validate.rules).repeated .min_items = 1]; } // Wrapper for batches of TCP access log entries. message TCPAccessLogEntries { - repeated TCPAccessLogEntry log_entry = 1; + repeated TCPAccessLogEntry log_entry = 1 [(validate.rules).repeated .min_items = 1]; } // Batches of log entries of a single type. Generally speaking, a given stream should only // ever incude one type of log entry. oneof log_entries { + option (validate.required) = true; + HTTPAccessLogEntries http_logs = 2; TCPAccessLogEntries tcp_logs = 3; }