I am trying to mask password using @type record_transformer
some of my application log statement don't have message due to this am getting below Error from td-agent log file
is there any to over come this issue.
How to ignore this if message field not found.
2021-09-28 18:05:15.751529402 +0000 fluent.warn: {"error":"#<RuntimeError: failed to expand `record[\"message\"].gsub(/[Pp]assword*([^,]*)/,'******').gsub(/([Aa]uthorization\\s*.\\s*[Bb]earer\\s)[\\w\\.\\-^]+/,'******').gsub(/([Aa]uthorization_ml\\s*.\\s*[Bb]earer\\s)[\\w\\.\\-^]+/,'******')` : error = undefined method `gsub' for nil:NilClass>","location":"/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.11.1/lib/fluent/plugin/filter_record_transformer.rb:310:in `rescue in expand'","
The object which is having
#gsub
called (likely a String) isnil
. Look for missing data getting to the record_transformer - maybe an incorrect Hash lookup returningnil
?You can guard on nil with the
#nil?
method on each object.