contour icon indicating copy to clipboard operation
contour copied to clipboard

Enhance Contour's Envoy Logging Configuration for Field Omission of Null/Empty Values

Open m-yosefpor opened this issue 1 year ago • 0 comments
trafficstars

Issue Description:

Currently, when utilizing Contour's Envoy logging configuration, there is no built-in mechanism to handle or omit fields with null or empty values in the generated logs. This behavior can lead to verbose logs containing unnecessary or irrelevant information, potentially complicating log analysis and management processes.

To optimize the logging output and improve the clarity and relevance of Envoy logs generated by Contour, it is essential to introduce a dedicated configuration field within ContourConfiguration that controls the handling of null or empty values. By incorporating the omitEmptyValues option in the Envoy log configuration, users can selectively exclude fields that do not contain meaningful data, ensuring a more concise and efficient logging experience.

Proposed Implementation:

  1. Configuration Enhancement: Introduce a new field, omitEmptyValues, within the logging section of the ContourConfiguration resource. This field will allow users to specify whether Envoy logs should omit fields with null or empty values.
apiVersion: projectcontour.io/v1alpha1
kind: ContourConfiguration
metadata:
  name: example
spec:
  envoy:
    logging:
      accessLogFormat: json
      omitEmptyValues: true ## default to false to ensure backward compatibility
      accessLogJSONFields:
      - "@timestamp"
      - "authority"
      - "bytes_received"
       ....
      - "header_foo=%RESP(foo)%"
      - "header_bar=%RESP(bar)%"

By introducing the omitEmptyValues option in Contour's Envoy logging configuration, users can have more control over the logging output, promoting cleaner and more actionable logs that facilitate efficient monitoring and troubleshooting activities.

m-yosefpor avatar Jan 10 '24 10:01 m-yosefpor