Reduce App Server Logging of HTTP Requests - #74194
Conversation
Co-Authored-By: Claude <claude@users.noreply.github.com>
| module Cdo | ||
| # Replaces lograge's fixed-severity, always-emit logging with the status-based | ||
| # policy above. Prepended onto Lograge::RequestLogSubscriber (whose | ||
| # process_exception is an alias of process_action, so this covers both). |
There was a problem hiding this comment.
Is this how prepending a module actually works? Or will the process_exception alias still point to the original Lograge implementation?
The tests only execute process_action
| RequestStore.store[Cdo::HttpRequestLogging::EXCEPTION_KEY] | ||
| # Copy before filtering: CDO.filter_backtrace mutates in place and the | ||
| # same exception is reported to Sentry/HoneyBadger. | ||
| data[:backtrace] = CDO.filter_backtrace(exception.backtrace.map(&:dup)) if exception&.backtrace |
There was a problem hiding this comment.
Codex is worried about this possibly being too big and getting truncated into malformed JSON.
Large 5xx backtraces will become malformed JSON
The PR inserts the complete backtrace into one structured log record. The “filter” merely rewrites paths and removes rake frames—it imposes no length limit—and the CEE formatter emits it as one JSON line.
The repository’s rsyslog configuration does not increase the message limit, while rsyslog defaults to 8 KB and truncates oversized messages. Therefore, any sufficiently long Rails trace will arrive in CloudWatch as invalid, unparseable JSON—precisely when the log matters most. rsyslog documentation
Fix: impose a byte-aware ceiling before JSON serialization and include a backtrace_truncated marker, or increase the full pipeline’s limit and verify it end-to-end.
There was a problem hiding this comment.
Agreed. I think I was overzealous about wanting a stack trace. We already have Sentry and HoneyBadger for that. I'm going to rip out this functionality. It makes it unnecessarily complex and changes the web application server HTTP request log into something different from what the intention of lograge is (compact Rails request logging).
Co-Authored-By: Claude <claude@users.noreply.github.com>
Reduce CloudWatch log costs while retaining the ability to increase logging in real-time during investigation of an issue.
lograge(compact Rails HTTP request logging) on more environment typesTesting story
Deployment notes
Privacy and security