本文介绍了如何保护 kafka 连接,以便不记录 connection.url 以显示凭据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的问题是运行连接器时会记录凭据,我不想记录这些凭据.

The problem I am having is that credentials are being logged when running a connector, I don't want to log those.

任何线索将不胜感激.

推荐答案

尝试使用 connection.password 属性,记录时应屏蔽该值.像这样:

Try to use the connection.password property, the value should be masked while logging. Something like this :

curl -X POST http://localhost:8083/connectors -H "Content-Type: application/json" -d \
'{ 
   "name":"jdbc_source_mysql_01",
   "config":{    
      "connector.class":"io.confluent.connect.jdbc.JdbcSourceConnector"         
      "connection.url":"jdbc:mysql://mysql:3306/demo",
      "connection.user":"connect_user",
      "connection.password":"password",
      "topic.prefix":"mysql-01-",
      "mode":"bulk"
   }
}'

发布此日志应如下所示:

Post this the logs should look like :

INFO JdbcSourceTaskConfig values:
batch.max.rows = 100
connection.attempts = 3
connection.backoff.ms = 10000
connection.password = null
connection.url = jdbc:mysql://*REDACTED*

这篇关于如何保护 kafka 连接,以便不记录 connection.url 以显示凭据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 12:04