contour
contour copied to clipboard
Enhance Contour's Envoy Logging Configuration for Field Omission of Null/Empty Values
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:
- Configuration Enhancement: Introduce a new field,
omitEmptyValues, within theloggingsection of theContourConfigurationresource. 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.