Skip to content

Commit

Permalink
Hide encrypted_data content in sql log since those are huge when uplo…
Browse files Browse the repository at this point in the history
…ading files
  • Loading branch information
mtnstar committed Feb 5, 2024
1 parent 19ac6fc commit 49e21f5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions config/initializers/scrub_logs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module ActiveSupport
module TaggedLogging
module Formatter
# Hide Encryptable#encrypted_data column from SQL queries because it's huge.
def scrub_encrypted_data_source(input)
input.gsub(/\["encrypted_data", ".*, \["/, '["encrypted_data", "REDACTED"], ["')
end

alias orig_call call

def call(severity, timestamp, progname, msg)
orig_call(severity, timestamp, progname, scrub_encrypted_data_source(msg))
end
end
end
end

0 comments on commit 49e21f5

Please sign in to comment.