envoy icon indicating copy to clipboard operation
envoy copied to clipboard

log: omit_empty_values not works correctly for new json formatter

Open wbpcode opened this issue 10 months ago • 12 comments

Title: [One line description](log: omit_empty_values not works correctly for new json formatter)

Description:

#35545 added new json formatter which provide much better performance than the legacy one by pre-serialize the json template when loading the configuration.

But this also result in a behavior change. In the previous implementation, if the omit_empty_values is set to true explicitly, one key/value pair will be ignore in the finaly json output if the value is null.

But now, it will be kept.

For example, given following log formatter

json_format: 
  key: %REQ(header-key)%

If the header-key is not exist in the request headers,

in the previous implementation, the final json output will be {},

in the new implementation, the final json output will be {"key":null}

wbpcode avatar Jan 09 '25 07:01 wbpcode