merlimat opened a new pull request, #25543:
URL: https://github.com/apache/pulsar/pull/25543

   ## Summary
   Replace `CustomRequestLog` + `Slf4jRequestLogWriter` (which emitted one 
pre-formatted NCSA-style line via SLF4J) with a `RequestLog` implementation 
that emits one structured slog event per HTTP request using the 
`Consumer<Event>` lambda form. Each field becomes a queryable attribute instead 
of being embedded in a format string.
   
   **Before** (one log line, NCSA-combined string):
   ```
   client1.example - alice [16/Apr/2026:11:30:22 -0700] "GET /admin/v2/.. 
HTTP/1.1" 200 128 "-" "curl/8.6.0" 42
   ```
   
   **After** (one structured event with attrs):
   - `method`, `uri`, `proto`
   - `status`, `bytesOut`
   - `clientAddr`, `clientPort`, `user`
   - `referer`, `userAgent`
   - `durationMs`
   - When `showDetailedAddresses=true`: `localAddr`, `localPort`, plus 
`clientAddrReal`/`clientPortReal`/`localAddrReal`/`localPortReal` when the 
proxy-protocol mapping resolves to a different endpoint than Jetty reports.
   
   Also drops the last consumer of `org.slf4j.Logger` in `pulsar-broker-common` 
— the request log path no longer pulls in SLF4J.
   
   ## User-visible changes
   - Log output format changes from NCSA-combined to slog's structured form. 
Any tool that parses the old access-log format will need to adapt.
   - Logger category changes from `org.eclipse.jetty.server.RequestLog` → 
`org.apache.pulsar.broker.web.JettyRequestLogFactory`. No in-tree 
`log4j2.yaml`/`log4j2.xml` references the old category.
   
   ## Implementation notes
   - Uses `log.info(Consumer<Event>)` form so the whole event assembly (Jetty 
attribute lookups, proxy-protocol map reads, `HostPort.normalizeHost`, etc.) is 
skipped entirely when INFO is disabled on this category.
   - Retains the same 
`JettyRequestLogFactory.createRequestLogger(showDetailedAddresses, server)` 
public API, so all four callers (`pulsar-broker`, `pulsar-proxy`, 
`pulsar-websocket`, `pulsar-functions-worker`) are unchanged.
   - Retains the `ProxyProtocolOriginalEndpointListener` bookkeeping for the 
detailed-addresses variant.
   
   ## Test plan
   - [x] `compileJava`, `compileTestJava`, `checkstyleMain`, `checkstyleTest` 
pass for `pulsar-broker-common`, `pulsar-broker`, `pulsar-proxy`, 
`pulsar-websocket`, `pulsar-functions-worker`
   - [ ] CI passes
   
   ### Motivation
   
   PIP-467


-- 
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