// Copyright 2025 Envoy Project Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package envoy.extensions.access_loggers.file.v3;

import "envoy/config/core/v3/substitution_format_string.proto";

import "google/protobuf/struct.proto";

import "envoy/annotations/deprecation.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.v3";
option java_outer_classname = "FileProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/file/v3;filev3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: File access log]
// [#extension: envoy.access_loggers.file]

// Custom configuration for an :ref:`AccessLog <envoy_v3_api_msg_config.accesslog.v3.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";

  // A path to a local file to which to write the access log entries.
  string path = 1 [(validate.rules).string = {min_len: 1}];

  oneof access_log_format {
    // 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
    // :ref:`default format <config_access_log_default_format>`.
    // 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, (envoy.annotations.deprecated_at_minor_version) = "3.0"];

    // Access log :ref:`format dictionary<config_access_log_format_dictionaries>`. All values
    // are rendered as strings.
    // 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, (envoy.annotations.deprecated_at_minor_version) = "3.0"];

    // 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
    // be produced by some command operators (e.g.FILTER_STATE or DYNAMIC_METADATA). See the
    // documentation for a specific command operator for details.
    // 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, (envoy.annotations.deprecated_at_minor_version) = "3.0"];

    // 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}];
  }
}
