fix(pulsar): redact error reason
Fixes https://emqx.atlassian.net/browse/EMQX-9940 Error log after fix: ``` 2023-05-19T13:09:26.304769+00:00 [error] msg: failed_to_start_pulsar_client, mfa: emqx_bridge_pulsar_impl_producer:on_start/2, line: 104, instance_id: <<"bridge:pulsar_producer:pprodu">>, pulsar_hosts: pulsar://pulsar:6652, reason: {#{{"pulsar",6652} => #{error => 'AuthenticationError',message => "Unable to authenticate",request_id => 18446744073709551615}},{child,undefined,'pulsar_producer:pprodu:emqx@127.0.0.1',{pulsar_client,start_link,['pulsar_producer:pprodu:emqx@127.0.0.1',["pulsar://pulsar:6652"],#{conn_opts => #{auth_data => <<"******">>,auth_method_name => <<"basic">>},ssl_opts => []}]},transient,false,5000,worker,[pulsar_client]}} ```
This commit is contained in:
parent
264404e180
commit
4327e40740
|
@ -100,7 +100,7 @@ on_start(InstanceId, Config) ->
|
|||
msg => "failed_to_start_pulsar_client",
|
||||
instance_id => InstanceId,
|
||||
pulsar_hosts => Servers,
|
||||
reason => Reason
|
||||
reason => emqx_utils:redact(Reason, fun is_sensitive_key/1)
|
||||
}),
|
||||
throw(failed_to_start_pulsar_client)
|
||||
end,
|
||||
|
@ -332,7 +332,7 @@ start_producer(Config, InstanceId, ClientId, ClientOpts) ->
|
|||
#{
|
||||
instance_id => InstanceId,
|
||||
kind => Kind,
|
||||
reason => Error,
|
||||
reason => emqx_utils:redact(Error, fun is_sensitive_key/1),
|
||||
stacktrace => Stacktrace
|
||||
}
|
||||
),
|
||||
|
@ -419,3 +419,6 @@ get_producer_status(Producers) ->
|
|||
|
||||
partition_strategy(key_dispatch) -> first_key_dispatch;
|
||||
partition_strategy(Strategy) -> Strategy.
|
||||
|
||||
is_sensitive_key(auth_data) -> true;
|
||||
is_sensitive_key(_) -> false.
|
||||
|
|
Loading…
Reference in New Issue