From 325aafe8576c3ac5dab8f91a9bc039fe19647fd9 Mon Sep 17 00:00:00 2001 From: "data-plane-api(Azure Pipelines)" Date: Mon, 15 May 2023 16:15:04 +0000 Subject: [PATCH] accesslog: support CEL command (#26428) Commit Message: accesslog: support CEL command in the formatter Risk Level: low Testing: unit Docs Changes: none Release Notes: yes Mirrored from https://github.com/envoyproxy/envoy @ 8cfeabd5bd0b15b5e6ef029bf9fef4dcaa1c8254 --- BUILD | 1 + envoy/extensions/formatter/cel/v3/BUILD | 9 ++++++ envoy/extensions/formatter/cel/v3/cel.proto | 34 +++++++++++++++++++++ versioning/BUILD | 1 + 4 files changed, 45 insertions(+) create mode 100644 envoy/extensions/formatter/cel/v3/BUILD create mode 100644 envoy/extensions/formatter/cel/v3/cel.proto diff --git a/BUILD b/BUILD index 36f2dbe7..898f318b 100644 --- a/BUILD +++ b/BUILD @@ -232,6 +232,7 @@ proto_library( "//envoy/extensions/filters/network/zookeeper_proxy/v3:pkg", "//envoy/extensions/filters/udp/dns_filter/v3:pkg", "//envoy/extensions/filters/udp/udp_proxy/v3:pkg", + "//envoy/extensions/formatter/cel/v3:pkg", "//envoy/extensions/formatter/metadata/v3:pkg", "//envoy/extensions/formatter/req_without_query/v3:pkg", "//envoy/extensions/health_checkers/redis/v3:pkg", diff --git a/envoy/extensions/formatter/cel/v3/BUILD b/envoy/extensions/formatter/cel/v3/BUILD new file mode 100644 index 00000000..ee92fb65 --- /dev/null +++ b/envoy/extensions/formatter/cel/v3/BUILD @@ -0,0 +1,9 @@ +# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. + +load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") + +licenses(["notice"]) # Apache 2 + +api_proto_package( + deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"], +) diff --git a/envoy/extensions/formatter/cel/v3/cel.proto b/envoy/extensions/formatter/cel/v3/cel.proto new file mode 100644 index 00000000..ca9d01de --- /dev/null +++ b/envoy/extensions/formatter/cel/v3/cel.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; + +package envoy.extensions.formatter.cel.v3; + +import "udpa/annotations/status.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.formatter.cel.v3"; +option java_outer_classname = "CelProto"; +option java_multiple_files = true; +option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/formatter/cel/v3;celv3"; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Formatter extension for printing CEL expressions] +// [#extension: envoy.formatter.cel] + +// CEL formatter extension implements CEL command operator that evaluates configured +// symbolic Common Expression Language expressions to generate an access log. +// +// See :ref:`here ` for more information on access log configuration. + +// %CEL(EXPRESSION):Z% +// Expressions are based on the set of Envoy :ref:`attributes `. +// Expression errors are considered `-`. Z is an optional parameter denoting string +// truncation up to Z characters long. +// +// Examples: +// - ``%CEL(response.code)%`` +// - ``%CEL(connection.mtls)%`` +// - ``%CEL(request.headers['x-envoy-original-path']):10%`` +// - ``%CEL(request.headers['x-log-mtls'] || request.url_path.contains('v1beta3'))%`` + +// Configuration for the CEL formatter. +message Cel { +} diff --git a/versioning/BUILD b/versioning/BUILD index 2f201794..ad7aa0d7 100644 --- a/versioning/BUILD +++ b/versioning/BUILD @@ -170,6 +170,7 @@ proto_library( "//envoy/extensions/filters/network/zookeeper_proxy/v3:pkg", "//envoy/extensions/filters/udp/dns_filter/v3:pkg", "//envoy/extensions/filters/udp/udp_proxy/v3:pkg", + "//envoy/extensions/formatter/cel/v3:pkg", "//envoy/extensions/formatter/metadata/v3:pkg", "//envoy/extensions/formatter/req_without_query/v3:pkg", "//envoy/extensions/health_checkers/redis/v3:pkg",