fix: include client addresses in WebUI request logs#2982
Conversation
SummaryReading Code referenceThe new shape, from the diff: record_data = {
'ts': time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()),
'remote': remote,
'method': getattr(self, 'command', None) or '-',
'path': getattr(self, 'path', None) or '-',
'status': int(code) if str(code).isdigit() else code,
'ms': duration_ms,
}
if forwarded_for:
record_data['forwarded_for'] = forwarded_forThe malformed test gains ObservationsTwo small things to consider before this merges:
Test planExisting tests pass under the diff; the three cases — malformed-no-client-address, direct-client, and XFF-present — line up with the three code paths through the Nothing in this PR needs a hold from me; the suggestions are non-blocking. Thanks for the targeted fix. |
a6c65de
Summary
Why
This makes failed WebUI login/access logs usable for downstream security tooling such as fail2ban, especially when the WebUI is behind a reverse proxy.
Test Plan