[18.0][IMP] monitoring_log_requests: capture RPC params for audit replay#518
Open
dnplkndll wants to merge 5 commits into
Open
[18.0][IMP] monitoring_log_requests: capture RPC params for audit replay#518dnplkndll wants to merge 5 commits into
dnplkndll wants to merge 5 commits into
Conversation
- Add /websocket to blacklist (Odoo 18 uses websockets for bus) - Fix response_status_code: hasattr checked request instead of response, and wrote to wrong key (status_code vs response_status_code) - Add default "" for PATH_INFO to avoid NoneType.startswith error
Add optional parameter capture to request logs for audit trail and replay capability. Controlled by MONITORING_LOG_PARAMS_MAX_SIZE env var (default 4096 bytes, set to 0 to disable). Parameters are sanitized before logging: - Binary data (bytes) is excluded - Large strings (>1000 chars) are replaced with length summary - Nested structures limited to 3 levels depth - Lists truncated to 20 items, dicts to 30 keys - Total serialized size capped at max_size
Wrap super()._dispatch in try/except/finally so that requests which raise also produce a monitoring.http.requests log entry. Adds exception_type and exception_message fields, and logs at ERROR with exc_info when an exception occurred. Successful requests continue to log at INFO. Closes the observability gap where failed XMLRPC/JSONRPC calls were captured by Sentry but absent from the request log stream (odoo_rpc).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add optional RPC parameter capture to request logs, enabling operation replay from logs on a backup database.
Changes
_sanitize_params()helper that strips binary data, truncates large strings, and caps total sizeargsandkwargsfrom RPC calls alongside model/methodMONITORING_LOG_PARAMS_MAX_SIZEenv var (default 4096, set 0 to disable)Use case
When investigating production issues, the captured params allow replaying the exact operations on a database backup to understand what happened and when.
Depends on: #FIX PR above