ruanweihong-aaa commented on issue #13452:
URL: https://github.com/apache/apisix/issues/13452#issuecomment-6331806668

   I checked the shared logging implementation to understand the scope of this 
request.
   
   The following plugins use `log-util.get_log_entry()` and include request 
headers in their default log payloads:
   
   - `loki-logger`, `http-logger`, `file-logger`
   - `tcp-logger`, `udp-logger`, `syslog`
   - `kafka-logger`, `rocketmq-logger` (with the default JSON format)
   - `elasticsearch-logger`, `clickhouse-logger`
   - `skywalking-logger`, `sls-logger`, `tencent-cloud-cls`
   - `splunk-hec-logging`, `loggly`
   
   The shared `get_log_entry()` implementation selects either a custom 
`log_format` or the default full log entry:
   
   
https://github.com/apache/apisix/blob/c4f09e1f8297f5d825c26b9de310688b0fc127a8/apisix/utils/log-util.lua#L305-L322
   
   The default entry uses the masked header view when `data-mask` has provided 
one; otherwise, it collects request headers without a sensitive-header 
exclusion list:
   
   
https://github.com/apache/apisix/blob/c4f09e1f8297f5d825c26b9de310688b0fc127a8/apisix/utils/log-util.lua#L197-L204
   
   `google-cloud-logging` also uses this helper, but its default output selects 
specific fields rather than exporting the full request headers:
   
   
https://github.com/apache/apisix/blob/c4f09e1f8297f5d825c26b9de310688b0fc127a8/apisix/plugins/google-cloud-logging.lua#L191-L218
   
   Therefore, filtering sensitive headers in the shared default log entry would 
affect multiple plugins. Removing these fields by default would change existing 
log payloads and could affect users relying on them. An optional exclusion list 
could preserve existing behavior when unset, but would still need configuration 
schema support and regression coverage for the participating plugins. Custom 
formats, labels, and explicitly configured fields would need clearly defined 
behavior.
   
   Kafka and RocketMQ's `origin` format also uses a separate path, 
`get_req_original()`, which would need separate consideration:
   
   
https://github.com/apache/apisix/blob/c4f09e1f8297f5d825c26b9de310688b0fc127a8/apisix/utils/log-util.lua#L358-L364
   
   Following @Baoyuantop's suggestion, could you clarify what prevents using 
`log_format` for your use case? Is the requirement to retain the complete 
default log structure while excluding only a few headers, or specifically to 
change the out-of-the-box defaults?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to