This is an automated email from the ASF dual-hosted git repository.

hefengen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new bf2f47414 [Task] desensitization of main fields in logs #3861 (#4012)
bf2f47414 is described below

commit bf2f474140949c4e0e8131e0d31daa477dbbd2b8
Author: huanccwang <[email protected]>
AuthorDate: Wed Sep 28 18:45:35 2022 +0800

    [Task] desensitization of main fields in logs #3861 (#4012)
    
    * Consolidate etcd dependencies into one #3807
    
    * Consolidate etcd dependencies into one #3807
    
    * [Task] desensitization of main fields in logs #3861
    
    * add license
    
    * add license
    
    * 修改keyword匹配规则为正则
    
    * 1.增加mysql,orcale,pg,h2初始化ddl 2.补充单测 3.优化代码
    
    * 解决冲突
    
    * 优化代码
    
    * format
    
    Co-authored-by: wanghuan171 <[email protected]>
---
 db/init/mysql/schema.sql                           |  29 ++++++
 db/init/oracle/schema.sql                          |  87 +++++++++++++++++
 db/init/pg/create-table.sql                        |  32 +++++-
 .../src/main/resources/sql-script/h2/schema.sql    |  30 +++++-
 .../logging/common/AbstractLoggingPlugin.java      |  30 +++++-
 .../common/body/LoggingServerHttpResponse.java     |  84 +++++++++++++++-
 .../common/constant/GenericLoggingConstant.java    | 108 +++++++++++++++++++--
 .../common/datamask/DataMaskByCharReplace.java     |  68 +++++++++++++
 .../logging/common/datamask/DataMaskByMD5.java     |  35 +++++++
 .../logging/common/datamask/DataMaskInterface.java |  32 ++++++
 .../logging/common/datamask/KeyWordMatch.java      |  60 ++++++++++++
 .../logging/common/entity/ShenyuRequestLog.java    |  18 ++--
 .../common/body/LoggingServerHttpResponseTest.java |  15 ++-
 .../common/datamask/DataMaskByCharReplaceTest.java |  51 ++++++++++
 .../logging/common/datamask/DataMaskByMD5Test.java |  44 +++++++++
 .../logging/common/datamask/KeyWordMatchTest.java  |  48 +++++++++
 .../common/entity/ShenyuRequestLogTest.java        |   2 +-
 .../common/utils/LogCollectConfigUtilsTest.java    |   2 +-
 .../shenyu-plugin-logging-console/pom.xml          |   5 +
 .../logging/console/LoggingConsolePlugin.java      | 104 ++++++++++++++++----
 .../logging/console/config/DataMaskConfig.java     |  47 +++++++++
 21 files changed, 877 insertions(+), 54 deletions(-)

diff --git a/db/init/mysql/schema.sql b/db/init/mysql/schema.sql
index 5ecb4ca8b..654000ad2 100644
--- a/db/init/mysql/schema.sql
+++ b/db/init/mysql/schema.sql
@@ -920,6 +920,30 @@ INSERT INTO `plugin_handle` VALUES ('1529402613204172742', 
'8', 'loadBalance', '
 INSERT INTO `plugin_handle` VALUES ('1529402613204172743', '10', 
'flowRuleMaxQueueingTimeMs', 'flowRuleMaxQueueingTimeMs', 1, 2, 6, 
'{\"required\":\"0\",\"defaultValue\":\"500\"}', '2022-05-25 18:02:53', 
'2022-05-25 18:02:53');
 INSERT INTO `plugin_handle` VALUES ('1529402613204172744', '10', 
'flowRuleWarmUpPeriodSec', 'flowRuleWarmUpPeriodSec', 1, 2, 6, 
'{\"required\":\"0\",\"defaultValue\":\"10\"}', '2022-05-25 18:02:53', 
'2022-05-25 18:02:53');
 INSERT INTO `plugin_handle` VALUES ('1529402613204172745', '14', 
'addPrefixed', 'addPrefixed', 3, 2, 3, 
'{\"required\":\"1\",\"defaultValue\":\"false\"}', '2022-09-27 12:00:00', 
'2022-09-27 12:00:00');
+INSERT INTO `plugin_handle` VALUES ('1572620652359245824', '18', 'keyword', 
'keyword', 2, 2, 0, '{\"required\":\"0\",\"placeholder\":\"please use ‘;’ to 
split keyword\",\"rule\":\"\"}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO `plugin_handle` VALUES ('1572620783062147072', '18', 'maskType', 
'maskType', 3, 2, 1, 
'{\"required\":\"0\",\"defaultValue\":\"dataMaskByMD5\",\"rule\":\"\"}', 
'2022-09-22 00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO `plugin_handle` VALUES ('1572621008824754176', '18', 'maskStatus', 
'maskStatus', 3, 2, 2, 
'{\"required\":\"0\",\"defaultValue\":\"false\",\"rule\":\"\"}', '2022-09-22 
00:17:21.150', '2022-09-22 00:17:21.150');
+INSERT INTO `plugin_handle` VALUES ('1572620652359245824', '29', 'keyword', 
'keyword', 2, 2, 0, '{\"required\":\"0\",\"placeholder\":\"please use ‘;’ to 
split keyword\",\"rule\":\"\"}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO `plugin_handle` VALUES ('1572620783062147072', '29', 'maskType', 
'maskType', 3, 2, 1, 
'{\"required\":\"0\",\"defaultValue\":\"dataMaskByMD5\",\"rule\":\"\"}', 
'2022-09-22 00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO `plugin_handle` VALUES ('1572621008824754176', '29', 'maskStatus', 
'maskStatus', 3, 2, 2, 
'{\"required\":\"0\",\"defaultValue\":\"false\",\"rule\":\"\"}', '2022-09-22 
00:17:21.150', '2022-09-22 00:17:21.150');
+INSERT INTO `plugin_handle` VALUES ('1572620652359245824', '32', 'keyword', 
'keyword', 2, 2, 0, '{\"required\":\"0\",\"placeholder\":\"please use ‘;’ to 
split keyword\",\"rule\":\"\"}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO `plugin_handle` VALUES ('1572620783062147072', '32', 'maskType', 
'maskType', 3, 2, 1, 
'{\"required\":\"0\",\"defaultValue\":\"dataMaskByMD5\",\"rule\":\"\"}', 
'2022-09-22 00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO `plugin_handle` VALUES ('1572621008824754176', '32', 'maskStatus', 
'maskStatus', 3, 2, 2, 
'{\"required\":\"0\",\"defaultValue\":\"false\",\"rule\":\"\"}', '2022-09-22 
00:17:21.150', '2022-09-22 00:17:21.150');
+INSERT INTO `plugin_handle` VALUES ('1572620652359245824', '33', 'keyword', 
'keyword', 2, 2, 0, '{\"required\":\"0\",\"placeholder\":\"please use ‘;’ to 
split keyword\",\"rule\":\"\"}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO `plugin_handle` VALUES ('1572620783062147072', '33', 'maskType', 
'maskType', 3, 2, 1, 
'{\"required\":\"0\",\"defaultValue\":\"dataMaskByMD5\",\"rule\":\"\"}', 
'2022-09-22 00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO `plugin_handle` VALUES ('1572621008824754176', '33', 'maskStatus', 
'maskStatus', 3, 2, 2, 
'{\"required\":\"0\",\"defaultValue\":\"false\",\"rule\":\"\"}', '2022-09-22 
00:17:21.150', '2022-09-22 00:17:21.150');
+INSERT INTO `plugin_handle` VALUES ('1572620652359245824', '34', 'keyword', 
'keyword', 2, 2, 0, '{\"required\":\"0\",\"placeholder\":\"please use ‘;’ to 
split keyword\",\"rule\":\"\"}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO `plugin_handle` VALUES ('1572620783062147072', '34', 'maskType', 
'maskType', 3, 2, 1, 
'{\"required\":\"0\",\"defaultValue\":\"dataMaskByMD5\",\"rule\":\"\"}', 
'2022-09-22 00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO `plugin_handle` VALUES ('1572621008824754176', '34', 'maskStatus', 
'maskStatus', 3, 2, 2, 
'{\"required\":\"0\",\"defaultValue\":\"false\",\"rule\":\"\"}', '2022-09-22 
00:17:21.150', '2022-09-22 00:17:21.150');
+INSERT INTO `plugin_handle` VALUES ('1572620652359245824', '35', 'keyword', 
'keyword', 2, 2, 0, '{\"required\":\"0\",\"placeholder\":\"please use ‘;’ to 
split keyword\",\"rule\":\"\"}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO `plugin_handle` VALUES ('1572620783062147072', '35', 'maskType', 
'maskType', 3, 2, 1, 
'{\"required\":\"0\",\"defaultValue\":\"dataMaskByMD5\",\"rule\":\"\"}', 
'2022-09-22 00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO `plugin_handle` VALUES ('1572621008824754176', '35', 'maskStatus', 
'maskStatus', 3, 2, 2, 
'{\"required\":\"0\",\"defaultValue\":\"false\",\"rule\":\"\"}', '2022-09-22 
00:17:21.150', '2022-09-22 00:17:21.150');
+INSERT INTO `plugin_handle` VALUES ('1572620652359245824', '36', 'keyword', 
'keyword', 2, 2, 0, '{\"required\":\"0\",\"placeholder\":\"please use ‘;’ to 
split keyword\",\"rule\":\"\"}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO `plugin_handle` VALUES ('1572620783062147072', '36', 'maskType', 
'maskType', 3, 2, 1, 
'{\"required\":\"0\",\"defaultValue\":\"dataMaskByMD5\",\"rule\":\"\"}', 
'2022-09-22 00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO `plugin_handle` VALUES ('1572621008824754176', '36', 'maskStatus', 
'maskStatus', 3, 2, 2, 
'{\"required\":\"0\",\"defaultValue\":\"false\",\"rule\":\"\"}', '2022-09-22 
00:17:21.150', '2022-09-22 00:17:21.150');
+INSERT INTO `plugin_handle` VALUES ('1572620652359245824', '38', 'keyword', 
'keyword', 2, 2, 0, '{\"required\":\"0\",\"placeholder\":\"please use ‘;’ to 
split keyword\",\"rule\":\"\"}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO `plugin_handle` VALUES ('1572620783062147072', '38', 'maskType', 
'maskType', 3, 2, 1, 
'{\"required\":\"0\",\"defaultValue\":\"dataMaskByMD5\",\"rule\":\"\"}', 
'2022-09-22 00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO `plugin_handle` VALUES ('1572621008824754176', '38', 'maskStatus', 
'maskStatus', 3, 2, 2, 
'{\"required\":\"0\",\"defaultValue\":\"false\",\"rule\":\"\"}', '2022-09-22 
00:17:21.150', '2022-09-22 00:17:21.150');
 
 -- ----------------------------
 -- Table structure for resource
@@ -1578,6 +1602,11 @@ INSERT INTO `shenyu_dict` VALUES ('1529402613195784280', 
'saslMechanism', 'SASL_
 INSERT INTO `shenyu_dict` VALUES ('1529402613195784281', 'saslMechanism', 
'SASL_MECHANISM', 'SCRAM-SHA-512', 'SCRAM-SHA-512', '', 5, 1, '2022-09-02 
00:00:00', '2022-09-02 00:00:00');
 INSERT INTO `shenyu_dict` VALUES ('1529402613195784282', 'addPrefixed', 
'ADD_PREFIXED', 'open', 'true', '', 0, 1, '2022-09-27 12:00:00', '2022-09-27 
12:00:00');
 INSERT INTO `shenyu_dict` VALUES ('1529402613195784283', 'addPrefixed', 
'ADD_PREFIXED', 'close', 'false', '', 1, 1, '2022-09-27 12:00:00', '2022-09-27 
12:00:00');
+INSERT INTO `shenyu_dict` VALUES ('1572621145865248768', 'keyword', 
'MASK_KEYWORD', 'keyword', 'keyword', '', 0, 1, '2022-09-22 00:17:55.137', 
'2022-09-22 00:17:55.137');
+INSERT INTO `shenyu_dict` VALUES ('1572621497251454976', 'maskType', 
'MASKTYPE_ENCRYPT', 'encrypt', 'dataMaskByMD5', '', 0, 1, '2022-09-22 
00:19:17.595', '2022-09-22 00:19:17.595');
+INSERT INTO `shenyu_dict` VALUES ('1572621587282190336', 'maskType', 
'MASKTYPE_REPLACE', 'replace', 'dataMaskByCharReplace', '', 0, 1, '2022-09-22 
00:19:39.060', '2022-09-22 00:19:39.060');
+INSERT INTO `shenyu_dict` VALUES ('1572621912915369984', 'maskStatus', 
'MASK_STATUS_FALSE', 'notmask', 'false', '', 0, 1, '2022-09-22 00:20:56.693', 
'2022-09-22 00:20:56.693');
+INSERT INTO `shenyu_dict` VALUES ('1572621976689762304', 'maskStatus', 
'MASK_STATUS_TRUE', 'mask', 'true', '', 0, 1, '2022-09-22 00:21:11.924', 
'2022-09-22 00:21:11.924');
 
 -- ----------------------------
 -- Table structure for user_role
diff --git a/db/init/oracle/schema.sql b/db/init/oracle/schema.sql
index d8ec066b7..638811a89 100644
--- a/db/init/oracle/schema.sql
+++ b/db/init/oracle/schema.sql
@@ -1547,6 +1547,78 @@ values ('1518229897214468229', '10', 
'flowRuleWarmUpPeriodSec', 'flowRuleWarmUpP
 INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
 VALUES ('1518229897214468230', '14', 'addPrefixed', 'addPrefixed', 3, 2, 3, 
'{"required":"1","defaultValue":"false"}');
 
+INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620652359245824', '18', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620783062147072', '18', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572621008824754176', '18', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620652359245824', '29', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620783062147072', '29', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572621008824754176', '29', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620652359245824', '32', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620783062147072', '32', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572621008824754176', '32', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620652359245824', '33', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620783062147072', '33', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572621008824754176', '33', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620652359245824', '34', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620783062147072', '34', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572621008824754176', '34', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620652359245824', '35', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620783062147072', '35', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572621008824754176', '35', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620652359245824', '36', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620783062147072', '36', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572621008824754176', '36', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620652359245824', '38', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572620783062147072', '38', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) 
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT, 
EXT_OBJ)
+values ('1572621008824754176', '38', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+
 insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(shenyu_dict(type, dict_code, dict_name)) 
*/ into SHENYU_DICT (ID, TYPE, DICT_CODE, DICT_NAME, DICT_VALUE, "desc", SORT, 
ENABLED)
 VALUES ('1529402613195784271', 'securityProtocol', 'SECURITY_PROTOCOL', 
'default', '', '', 0, 1);
 
@@ -1586,6 +1658,21 @@ VALUES ('1529402613195784282', 'addPrefixed', 
'ADD_PREFIXED', 'open', 'true', ''
 INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(shenyu_dict(type, dict_code, dict_name)) 
*/ into SHENYU_DICT (ID, TYPE, DICT_CODE, DICT_NAME, DICT_VALUE, "desc", SORT, 
ENABLED)
 VALUES ('1529402613195784283', 'addPrefixed', 'ADD_PREFIXED', 'close', 
'false', '', 1, 1);
 
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(shenyu_dict(type, dict_code, dict_name)) 
*/ into SHENYU_DICT (ID, TYPE, DICT_CODE, DICT_NAME, DICT_VALUE, "desc", SORT, 
ENABLED)
+values ('1572621145865248768', 'keyword', 'MASK_KEYWORD', 'keyword', 
'keyword', '', 0, 1);
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(shenyu_dict(type, dict_code, dict_name)) 
*/ into SHENYU_DICT (ID, TYPE, DICT_CODE, DICT_NAME, DICT_VALUE, "desc", SORT, 
ENABLED)
+values ('1572621497251454976', 'maskType', 'MASKTYPE_ENCRYPT', 'encrypt', 
'dataMaskByMD5', '', 0, 1);
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(shenyu_dict(type, dict_code, dict_name)) 
*/ into SHENYU_DICT (ID, TYPE, DICT_CODE, DICT_NAME, DICT_VALUE, "desc", SORT, 
ENABLED)
+values ('1572621587282190336', 'maskType', 'MASKTYPE_REPLACE', 'replace', 
'dataMaskByCharReplace', '', 0, 1);
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(shenyu_dict(type, dict_code, dict_name)) 
*/ into SHENYU_DICT (ID, TYPE, DICT_CODE, DICT_NAME, DICT_VALUE, "desc", SORT, 
ENABLED)
+values ('1572621912915369984', 'maskStatus', 'MASK_STATUS_FALSE', 'notmask', 
'false', '', 0, 1);
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(shenyu_dict(type, dict_code, dict_name)) 
*/ into SHENYU_DICT (ID, TYPE, DICT_CODE, DICT_NAME, DICT_VALUE, "desc", SORT, 
ENABLED)
+values ('1572621976689762304', 'maskStatus', 'MASK_STATUS_TRUE', 'mask', 
'true', '', 0, 1);
+
 /** insert resource for resource */
 INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX("resource" (id)) */ INTO "resource"   
(id, parent_id, title, name, url, component, resource_type, sort, icon, 
is_leaf, is_route, perms, status) 
VALUES('1346775491550474240','','SHENYU.MENU.PLUGIN.LIST','plug','/plug','PluginList','0','0','dashboard','0','0','','1');
 
diff --git a/db/init/pg/create-table.sql b/db/init/pg/create-table.sql
index 5eae75c10..51331bd72 100644
--- a/db/init/pg/create-table.sql
+++ b/db/init/pg/create-table.sql
@@ -1008,8 +1008,30 @@ INSERT INTO "public"."plugin_handle" VALUES 
('1529402613204172802', '8', 'loadBa
 INSERT INTO "public"."plugin_handle" VALUES ('1529402613204172803', '10', 
'flowRuleMaxQueueingTimeMs', 'flowRuleMaxQueueingTimeMs', 1, 2, 6, 
'{"required":"0","defaultValue":"500"}', '2022-06-30 21:00:00', '2022-06-30 
21:00:00');
 INSERT INTO "public"."plugin_handle" VALUES ('1529402613204172804', '10', 
'flowRuleWarmUpPeriodSec', 'flowRuleWarmUpPeriodSec', 1, 2, 6, 
'{"required":"0","defaultValue":"10"}', '2022-06-30 21:00:00', '2022-06-30 
21:00:00');
 INSERT INTO "public"."plugin_handle" VALUES ('1529402613204172805', '14', 
'addPrefixed', 'addPrefixed', 3, 2, 3, 
'{"required":"1","defaultValue":"false"}', '2022-09-27 12:00:00', '2022-09-27 
12:00:00');
-
-
+INSERT INTO "public"."plugin_handle" VALUES ('1572620652359245824', '18', 
'keyword', 'keyword', 2, 2, 0, '{"required":"0","placeholder":"please use ‘;’ 
to split keyword","rule":""}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620783062147072', '18', 
'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}', '2022-09-22 
00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO "public"."plugin_handle" VALUES ('1572621008824754176', '18', 
'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}', '2022-09-22 00:17:21.150', 
'2022-09-22 00:17:21.150');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620652359245824', '29', 
'keyword', 'keyword', 2, 2, 0, '{"required":"0","placeholder":"please use ‘;’ 
to split keyword","rule":""}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620783062147072', '29', 
'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}', '2022-09-22 
00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO "public"."plugin_handle" VALUES ('1572621008824754176', '29', 
'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}', '2022-09-22 00:17:21.150', 
'2022-09-22 00:17:21.150');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620652359245824', '32', 
'keyword', 'keyword', 2, 2, 0, '{"required":"0","placeholder":"please use ‘;’ 
to split keyword","rule":""}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620783062147072', '32', 
'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}', '2022-09-22 
00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO "public"."plugin_handle" VALUES ('1572621008824754176', '32', 
'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}', '2022-09-22 00:17:21.150', 
'2022-09-22 00:17:21.150');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620652359245824', '33', 
'keyword', 'keyword', 2, 2, 0, '{"required":"0","placeholder":"please use ‘;’ 
to split keyword","rule":""}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620783062147072', '33', 
'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}', '2022-09-22 
00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO "public"."plugin_handle" VALUES ('1572621008824754176', '33', 
'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}', '2022-09-22 00:17:21.150', 
'2022-09-22 00:17:21.150');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620652359245824', '34', 
'keyword', 'keyword', 2, 2, 0, '{"required":"0","placeholder":"please use ‘;’ 
to split keyword","rule":""}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620783062147072', '34', 
'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}', '2022-09-22 
00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO "public"."plugin_handle" VALUES ('1572621008824754176', '34', 
'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}', '2022-09-22 00:17:21.150', 
'2022-09-22 00:17:21.150');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620652359245824', '35', 
'keyword', 'keyword', 2, 2, 0, '{"required":"0","placeholder":"please use ‘;’ 
to split keyword","rule":""}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620783062147072', '35', 
'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}', '2022-09-22 
00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO "public"."plugin_handle" VALUES ('1572621008824754176', '35', 
'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}', '2022-09-22 00:17:21.150', 
'2022-09-22 00:17:21.150');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620652359245824', '36', 
'keyword', 'keyword', 2, 2, 0, '{"required":"0","placeholder":"please use ‘;’ 
to split keyword","rule":""}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620783062147072', '36', 
'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}', '2022-09-22 
00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO "public"."plugin_handle" VALUES ('1572621008824754176', '36', 
'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}', '2022-09-22 00:17:21.150', 
'2022-09-22 00:17:21.150');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620652359245824', '38', 
'keyword', 'keyword', 2, 2, 0, '{"required":"0","placeholder":"please use ‘;’ 
to split keyword","rule":""}', '2022-09-22 00:15:56.158', '2022-09-22 
00:23:36.169');
+INSERT INTO "public"."plugin_handle" VALUES ('1572620783062147072', '38', 
'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}', '2022-09-22 
00:16:27.342', '2022-09-22 00:16:27.342');
+INSERT INTO "public"."plugin_handle" VALUES ('1572621008824754176', '38', 
'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}', '2022-09-22 00:17:21.150', 
'2022-09-22 00:17:21.150');
 -- ----------------------------
 -- Table structure for resource
 -- ----------------------------
@@ -1736,7 +1758,11 @@ INSERT INTO "public"."shenyu_dict" VALUES 
('1529402613195784280', 'saslMechanism
 INSERT INTO "public"."shenyu_dict" VALUES ('1529402613195784281', 
'saslMechanism', 'SASL_MECHANISM', 'SCRAM-SHA-512', 'SCRAM-SHA-512', '', 5, 1, 
'2022-09-02 00:00:00', '2022-09-02 00:00:00');
 INSERT INTO "public"."shenyu_dict" VALUES ('1529402613195784282', 
'addPrefixed', 'ADD_PREFIXED', 'open', 'true', '', 0, 1, '2022-09-27 12:00:00', 
'2022-09-27 12:00:00');
 INSERT INTO "public"."shenyu_dict" VALUES ('1529402613195784283', 
'addPrefixed', 'ADD_PREFIXED', 'close', 'false', '', 1, 1, '2022-09-27 
12:00:00', '2022-09-27 12:00:00');
-
+INSERT INTO "public"."shenyu_dict" VALUES ('1572621145865248768', 'keyword', 
'MASK_KEYWORD', 'keyword', 'keyword', '', 0, 1, '2022-09-22 00:17:55.137', 
'2022-09-22 00:17:55.137');
+INSERT INTO "public"."shenyu_dict" VALUES ('1572621497251454976', 'maskType', 
'MASKTYPE_ENCRYPT', 'encrypt', 'dataMaskByMD5', '', 0, 1, '2022-09-22 
00:19:17.595', '2022-09-22 00:19:17.595');
+INSERT INTO "public"."shenyu_dict" VALUES ('1572621587282190336', 'maskType', 
'MASKTYPE_REPLACE', 'replace', 'dataMaskByCharReplace', '', 0, 1, '2022-09-22 
00:19:39.060', '2022-09-22 00:19:39.060');
+INSERT INTO "public"."shenyu_dict" VALUES ('1572621912915369984', 
'maskStatus', 'MASK_STATUS_FALSE', 'notmask', 'false', '', 0, 1, '2022-09-22 
00:20:56.693', '2022-09-22 00:20:56.693');
+INSERT INTO "public"."shenyu_dict" VALUES ('1572621976689762304', 
'maskStatus', 'MASK_STATUS_TRUE', 'mask', 'true', '', 0, 1, '2022-09-22 
00:21:11.924', '2022-09-22 00:21:11.924');
 
 
 -- ----------------------------
diff --git a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql 
b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
index 13b827c21..c8cf0d04c 100755
--- a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
+++ b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
@@ -365,7 +365,11 @@ INSERT IGNORE INTO `shenyu_dict` (`id`, 
`type`,`dict_code`, `dict_name`, `dict_v
 INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1529402613195784290', 
'saslMechanism', 'SASL_MECHANISM', 'OAUTHBEARER', 'OAUTHBEARER', '', 3, 1);
 INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1529402613195784291', 
'saslMechanism', 'SASL_MECHANISM', 'SCRAM-SHA-256', 'SCRAM-SHA-256', '', 4, 1);
 INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1529402613195784292', 
'saslMechanism', 'SASL_MECHANISM', 'SCRAM-SHA-512', 'SCRAM-SHA-512', '', 5, 1);
-
+INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1572621145865248768', 
'keyword', 'MASK_KEYWORD', 'keyword', 'keyword', '', 0, 1);
+INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1572621497251454976', 
'maskType', 'MASKTYPE_ENCRYPT', 'encrypt', 'dataMaskByMD5', '', 0, 1);
+INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1572621587282190336', 
'maskType', 'MASKTYPE_REPLACE', 'replace', 'dataMaskByCharReplace', '', 0, 1);
+INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1572621912915369984', 
'maskStatus', 'MASK_STATUS_FALSE', 'notmask', 'false', '', 0, 1);
+INSERT IGNORE INTO `shenyu_dict` (`id`, `type`,`dict_code`, `dict_name`, 
`dict_value`, `desc`, `sort`, `enabled`) VALUES ('1572621976689762304', 
'maskStatus', 'MASK_STATUS_TRUE', 'mask', 'true', '', 0, 1);
 
 /*plugin*/
 INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES 
('1','sign','Authentication',  20, '0');
@@ -636,6 +640,30 @@ INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,
 INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1529402613204172930', '36', 'maxRetryBackoffMs', 'maxRetryBackoffMs', 1, 3, 
15, '{"required":"0","defaultValue":50000}');
 INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1529402613204172931', '8', 'loadBalance', 'loadStrategy', 3, 2, 3, 
'{"defaultValue":"roundRobin","rule":""}');
 INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1529402613204172932', '14', 'prefixForwardEnable', 'prefixForwardEnable', 1, 
2, 3, '{"defaultValue":"1","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620652359245824', '18', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620783062147072', '18', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572621008824754176', '18', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620652359245824', '29', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620783062147072', '29', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572621008824754176', '29', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620652359245824', '32', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620783062147072', '32', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572621008824754176', '32', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620652359245824', '33', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620783062147072', '33', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572621008824754176', '33', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620652359245824', '34', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620783062147072', '34', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572621008824754176', '34', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620652359245824', '35', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620783062147072', '35', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572621008824754176', '35', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620652359245824', '36', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620783062147072', '36', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572621008824754176', '36', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620652359245824', '38', 'keyword', 'keyword', 2, 2, 0, 
'{"required":"0","placeholder":"please use ‘;’ to split keyword","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572620783062147072', '38', 'maskType', 'maskType', 3, 2, 1, 
'{"required":"0","defaultValue":"dataMaskByMD5","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`, 
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES 
('1572621008824754176', '38', 'maskStatus', 'maskStatus', 3, 2, 2, 
'{"required":"0","defaultValue":"false","rule":""}');
 
 
 /** insert resource for resource */
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/AbstractLoggingPlugin.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/AbstractLoggingPlugin.java
index d74ca13ba..801c3d302 100644
--- 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/AbstractLoggingPlugin.java
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/AbstractLoggingPlugin.java
@@ -17,15 +17,19 @@
 
 package org.apache.shenyu.plugin.logging.common;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.shenyu.common.dto.RuleData;
 import org.apache.shenyu.common.dto.SelectorData;
 import org.apache.shenyu.common.enums.PluginEnum;
+import org.apache.shenyu.common.utils.JsonUtils;
 import org.apache.shenyu.plugin.api.ShenyuPluginChain;
+import org.apache.shenyu.plugin.api.utils.SpringBeanUtils;
 import org.apache.shenyu.plugin.base.AbstractShenyuPlugin;
 import org.apache.shenyu.plugin.base.utils.HostAddressUtils;
 import org.apache.shenyu.plugin.logging.common.body.LoggingServerHttpRequest;
 import org.apache.shenyu.plugin.logging.common.body.LoggingServerHttpResponse;
 import org.apache.shenyu.plugin.logging.common.collector.LogCollector;
+import org.apache.shenyu.plugin.logging.common.datamask.DataMaskInterface;
 import org.apache.shenyu.plugin.logging.common.entity.ShenyuRequestLog;
 import org.apache.shenyu.plugin.logging.common.utils.LogCollectConfigUtils;
 import org.apache.shenyu.plugin.logging.common.utils.LogCollectUtils;
@@ -33,6 +37,12 @@ import 
org.springframework.http.server.reactive.ServerHttpRequest;
 import org.springframework.web.server.ServerWebExchange;
 import reactor.core.publisher.Mono;
 
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
 import static 
org.apache.shenyu.plugin.logging.common.constant.GenericLoggingConstant.HOST;
 import static 
org.apache.shenyu.plugin.logging.common.constant.GenericLoggingConstant.USER_AGENT;
 
@@ -41,6 +51,12 @@ import static 
org.apache.shenyu.plugin.logging.common.constant.GenericLoggingCon
  */
 public abstract class AbstractLoggingPlugin extends AbstractShenyuPlugin {
 
+    private static boolean maskFlag;
+
+    private static Set<String> keyWordSet = new HashSet<>();
+
+    private static DataMaskInterface dataMaskInterface;
+
     /**
      * LogCollector.
      *
@@ -57,7 +73,16 @@ public abstract class AbstractLoggingPlugin extends 
AbstractShenyuPlugin {
 
     @Override
     public Mono<Void> doExecute(final ServerWebExchange exchange, final 
ShenyuPluginChain chain,
-                                   final SelectorData selector, final RuleData 
rule) {
+                                final SelectorData selector, final RuleData 
rule) {
+
+        Map<String, String> handleMap = JsonUtils.jsonToMap(
+                Optional.ofNullable(rule).map(RuleData::getHandle).orElse(""), 
String.class);
+        String keyWords = handleMap.get("keyword");
+        maskFlag = StringUtils.isNotBlank(keyWords) && 
"true".equals(handleMap.get("maskStatus")) ? true : false;
+        if (maskFlag) {
+            Collections.addAll(keyWordSet, keyWords.split(";"));
+            dataMaskInterface = 
SpringBeanUtils.getInstance().getBean(handleMap.get("maskType"));
+        }
         ServerHttpRequest request = exchange.getRequest();
         // control sampling
         if (!LogCollectConfigUtils.isSampled(exchange.getRequest())) {
@@ -74,14 +99,13 @@ public abstract class AbstractLoggingPlugin extends 
AbstractShenyuPlugin {
         requestInfo.setPath(request.getURI().getPath());
         LoggingServerHttpRequest loggingServerHttpRequest = new 
LoggingServerHttpRequest(request, requestInfo);
         LoggingServerHttpResponse loggingServerHttpResponse = new 
LoggingServerHttpResponse(exchange.getResponse(),
-                requestInfo, this.logCollector());
+                requestInfo, this.logCollector(), maskFlag, keyWordSet, 
dataMaskInterface);
         ServerWebExchange webExchange = 
exchange.mutate().request(loggingServerHttpRequest)
                 .response(loggingServerHttpResponse).build();
         loggingServerHttpResponse.setExchange(webExchange);
         return 
chain.execute(webExchange).doOnError(loggingServerHttpResponse::logError);
     }
 
-
     /**
      * get plugin order.
      *
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/body/LoggingServerHttpResponse.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/body/LoggingServerHttpResponse.java
index 032470e49..97a99083c 100644
--- 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/body/LoggingServerHttpResponse.java
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/body/LoggingServerHttpResponse.java
@@ -21,11 +21,14 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.shenyu.common.constant.Constants;
 import org.apache.shenyu.common.enums.RpcTypeEnum;
 import org.apache.shenyu.common.utils.DateUtils;
+import org.apache.shenyu.common.utils.JsonUtils;
 import org.apache.shenyu.plugin.api.context.ShenyuContext;
 import org.apache.shenyu.plugin.api.result.ShenyuResult;
 import org.apache.shenyu.plugin.api.result.ShenyuResultWrap;
 import org.apache.shenyu.plugin.logging.common.collector.LogCollector;
 import org.apache.shenyu.plugin.logging.common.constant.GenericLoggingConstant;
+import org.apache.shenyu.plugin.logging.common.datamask.DataMaskInterface;
+import org.apache.shenyu.plugin.logging.common.datamask.KeyWordMatch;
 import org.apache.shenyu.plugin.logging.common.entity.ShenyuRequestLog;
 import org.apache.shenyu.plugin.logging.common.utils.LogCollectConfigUtils;
 import org.apache.shenyu.plugin.logging.common.utils.LogCollectUtils;
@@ -48,7 +51,9 @@ import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.Map;
 import java.util.Objects;
+import java.util.Set;
 
 /**
  * decorate ServerHttpResponse for read body.
@@ -65,18 +70,32 @@ public class LoggingServerHttpResponse extends 
ServerHttpResponseDecorator {
 
     private final LogCollector logCollector;
 
+    private final boolean maskFlag;
+
+    private final DataMaskInterface dataMaskInterface;
+
+    private final KeyWordMatch keyWordMatch;
+
     /**
      * Constructor LoggingServerHttpResponse.
      *
-     * @param delegate     delegate ServerHttpResponse
-     * @param logInfo      access log
-     * @param logCollector LogCollector  instance
+     * @param delegate          delegate ServerHttpResponse
+     * @param logInfo           access log
+     * @param logCollector      LogCollector  instance
+     * @param maskFlag          mask flag
+     * @param keyWordSet        user keyWord set
+     * @param dataMaskInterface mask function
      */
     public LoggingServerHttpResponse(final ServerHttpResponse delegate, final 
ShenyuRequestLog logInfo,
-                                     final LogCollector logCollector) {
+                                     final LogCollector logCollector, final 
boolean maskFlag,
+                                     final Set<String> keyWordSet, final 
DataMaskInterface dataMaskInterface) {
+
         super(delegate);
         this.logInfo = logInfo;
         this.logCollector = logCollector;
+        this.maskFlag = maskFlag;
+        this.dataMaskInterface = dataMaskInterface;
+        this.keyWordMatch = new KeyWordMatch(keyWordSet);
     }
 
     /**
@@ -150,6 +169,9 @@ public class LoggingServerHttpResponse extends 
ServerHttpResponseDecorator {
         if (size > 0 && !LogCollectConfigUtils.isResponseBodyTooLarge(size)) {
             logInfo.setResponseBody(body);
         }
+        if (maskFlag) {
+            mask(logInfo);
+        }
         // collect log
         if (Objects.nonNull(logCollector)) {
             logCollector.collect(logInfo);
@@ -232,6 +254,9 @@ public class LoggingServerHttpResponse extends 
ServerHttpResponseDecorator {
         if (size > 0 && !LogCollectConfigUtils.isResponseBodyTooLarge(size)) {
             logInfo.setResponseBody(body);
         }
+        if (maskFlag) {
+            mask(logInfo);
+        }
         // collect log
         if (Objects.nonNull(logCollector)) {
             logCollector.collect(logInfo);
@@ -250,4 +275,55 @@ public class LoggingServerHttpResponse extends 
ServerHttpResponseDecorator {
         }
         return "";
     }
+
+    private void mask(final ShenyuRequestLog logInfo) {
+
+        logInfo.setClientIp(maskForSingle(GenericLoggingConstant.CLIENT_IP, 
logInfo.getClientIp()));
+        logInfo.setTimeLocal(maskForSingle(GenericLoggingConstant.TIME_LOCAL, 
logInfo.getTimeLocal()));
+        logInfo.setMethod(maskForSingle(GenericLoggingConstant.METHOD, 
logInfo.getMethod()));
+        
logInfo.setRequestUri(maskForSingle(GenericLoggingConstant.REQUEST_URI, 
logInfo.getRequestUri()));
+        
logInfo.setResponseContentLength(Integer.valueOf(maskForSingle(GenericLoggingConstant.RESPONSE_CONTENT_LENGTH,
+                logInfo.getResponseContentLength().toString())));
+        logInfo.setRpcType(maskForSingle(GenericLoggingConstant.RPC_TYPE, 
logInfo.getRpcType()));
+        
logInfo.setStatus(Integer.valueOf(maskForSingle(GenericLoggingConstant.STATUS, 
logInfo.getStatus().toString())));
+        
logInfo.setUpstreamIp(maskForSingle(GenericLoggingConstant.UP_STREAM_IP, 
logInfo.getUpstreamIp()));
+        
logInfo.setUpstreamResponseTime(Long.valueOf(maskForSingle(GenericLoggingConstant.UP_STREAM_RESPONSE_TIME,
+                logInfo.getUpstreamResponseTime().toString())));
+        logInfo.setUserAgent(maskForSingle(GenericLoggingConstant.USERAGENT, 
logInfo.getUserAgent()));
+        logInfo.setHost(maskForSingle(GenericLoggingConstant.HOST, 
logInfo.getHost()));
+        logInfo.setModule(maskForSingle(GenericLoggingConstant.MODULE, 
logInfo.getModule()));
+        logInfo.setTraceId(maskForSingle(GenericLoggingConstant.TRACE_ID, 
logInfo.getTraceId()));
+        logInfo.setPath(maskForSingle(GenericLoggingConstant.PATH, 
logInfo.getPath()));
+        
logInfo.setRequestHeader(maskForSingle(GenericLoggingConstant.REQUEST_HEADER, 
logInfo.getRequestHeader()));
+        
logInfo.setResponseHeader(maskForSingle(GenericLoggingConstant.RESPONSE_HEADER,
+                logInfo.getResponseHeader()));
+        
logInfo.setQueryParams(maskForSingle(GenericLoggingConstant.QUERY_PARAMS, 
logInfo.getQueryParams()));
+        
logInfo.setRequestBody(maskForSingle(GenericLoggingConstant.REQUEST_BODY, 
logInfo.getRequestBody()));
+        
logInfo.setResponseBody(maskForSingle(GenericLoggingConstant.RESPONSE_BODY, 
logInfo.getResponseBody()));
+        logInfo.setRequestHeader(maskForBody(logInfo.getRequestHeader()));
+        logInfo.setResponseHeader(maskForBody(logInfo.getResponseHeader()));
+        logInfo.setQueryParams(maskForBody(logInfo.getQueryParams()));
+        logInfo.setRequestBody(maskForBody(logInfo.getRequestBody()));
+        logInfo.setResponseBody(maskForBody(logInfo.getResponseBody()));
+    }
+
+    private String maskForSingle(final String keyWord, final String val) {
+
+        return StringUtils.isNotBlank(val) && keyWordMatch.matches(keyWord) ? 
dataMaskInterface.mask(val) : val;
+    }
+
+    private String maskForBody(final String body) {
+
+        if (StringUtils.isNotBlank(body)) {
+            Map<String, String> bodyMap = JsonUtils.jsonToMap(body, 
String.class);
+            bodyMap.forEach((key, value) -> {
+                if (keyWordMatch.matches(key)) {
+                    bodyMap.put(key, dataMaskInterface.mask(value));
+                }
+            });
+            return bodyMap.toString();
+        } else {
+            return body;
+        }
+    }
 }
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/constant/GenericLoggingConstant.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/constant/GenericLoggingConstant.java
index 1d01da8a0..47dfd3888 100644
--- 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/constant/GenericLoggingConstant.java
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/constant/GenericLoggingConstant.java
@@ -21,40 +21,134 @@ package org.apache.shenyu.plugin.logging.common.constant;
  * generic logging constant.
  */
 public class GenericLoggingConstant {
-    
+
     /**
      * logging user agent.
      */
     public static final String USER_AGENT = "User-Agent";
-    
+
     /**
      * logging user host.
      */
     public static final String HOST = "Host";
-    
+
     /**
      * shenyu agent trace id.
      */
     public static final String SHENYU_AGENT_TRACE_ID = "shenyu-agent-trace-id";
-    
+
     /**
      * system default, max threads.
      */
     public static final Integer MAX_ALLOW_THREADS = 500;
-    
+
     /**
      * max queue.
      */
     public static final Integer MAX_QUEUE_NUMBER = 10000;
-    
+
     /**
      * default source.
      */
     public static final String DEFAULT_SOURCE = "shenyu-gateway";
-    
+
     /**
      * The constant INDEX.
      */
     public static final String INDEX = "shenyu-access-logging";
 
+    /**
+     * logging clientIp.
+     */
+    public static final String CLIENT_IP = "clientIp";
+
+    /**
+     * logging timeLocal.
+     */
+    public static final String TIME_LOCAL = "timeLocal";
+
+    /**
+     * logging method.
+     */
+    public static final String METHOD = "method";
+
+    /**
+     * logging request method.
+     */
+    public static final String REQUEST_METHOD = "request method";
+
+    /**
+     * logging request header.
+     */
+    public static final String REQUEST_HEADER = "requestHeader";
+
+    /**
+     * logging response header.
+     */
+    public static final String RESPONSE_HEADER = "responseHeader";
+
+    /**
+     * logging query params.
+     */
+    public static final String QUERY_PARAMS = "queryParams";
+
+    /**
+     * logging request body.
+     */
+    public static final String REQUEST_BODY = "requestBody";
+
+    /**
+     * logging request uri.
+     */
+    public static final String REQUEST_URI = "requestUri";
+
+    /**
+     * logging response body.
+     */
+    public static final String RESPONSE_BODY = "responseBody";
+
+    /**
+     * logging response content length.
+     */
+    public static final String RESPONSE_CONTENT_LENGTH = 
"responseContentLength";
+
+    /**
+     * logging rpcType.
+     */
+    public static final String RPC_TYPE = "rpcType";
+
+    /**
+     * logging status.
+     */
+    public static final String STATUS = "status";
+
+    /**
+     * logging upstreamIp.
+     */
+    public static final String UP_STREAM_IP = "upstreamIp";
+
+    /**
+     * logging upstreamResponseTime.
+     */
+    public static final String UP_STREAM_RESPONSE_TIME = 
"upstreamResponseTime";
+
+    /**
+     * logging userAgent.
+     */
+    public static final String USERAGENT = "userAgent";
+
+    /**
+     * logging module.
+     */
+    public static final String MODULE = "module";
+
+    /**
+     * logging traceId.
+     */
+    public static final String TRACE_ID = "traceId";
+
+    /**
+     * logging path.
+     */
+    public static final String PATH = "path";
 }
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskByCharReplace.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskByCharReplace.java
new file mode 100644
index 000000000..a944a5ba0
--- /dev/null
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskByCharReplace.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.plugin.logging.common.datamask;
+
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+@Service
+public class DataMaskByCharReplace implements DataMaskInterface {
+
+    private static final Character MASK = '*';
+
+    @Override
+    public String mask(final String data) {
+
+        if (!StringUtils.hasLength(data)) {
+            return "";
+        }
+        return doMask(data, data.length() / 2);
+    }
+
+    private String doMask(final String data, final int maskNum) {
+
+        if (data.length() == 1) {
+            return "*";
+        }
+        StringBuilder sb = new StringBuilder(data);
+        int mid = data.length() / 2;
+        int l = mid - 1;
+        int r = mid;
+        int currentMaskNum = 0;
+        while (currentMaskNum < maskNum) {
+            final int tempMaskNum = currentMaskNum;
+            if (r < data.length()) {
+                sb.setCharAt(r, MASK);
+                r++;
+                currentMaskNum++;
+            }
+            if (currentMaskNum >= maskNum) {
+                break;
+            }
+            if (l >= 0) {
+                sb.setCharAt(l, MASK);
+                l--;
+                currentMaskNum++;
+            }
+            if (tempMaskNum == currentMaskNum) {
+                break;
+            }
+        }
+        return sb.toString();
+    }
+}
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskByMD5.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskByMD5.java
new file mode 100644
index 000000000..97b63179e
--- /dev/null
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskByMD5.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.plugin.logging.common.datamask;
+
+import org.apache.shenyu.common.utils.Md5Utils;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+@Service
+public class DataMaskByMD5 implements DataMaskInterface {
+
+    @Override
+    public String mask(final String data) {
+
+        if (!StringUtils.hasLength(data)) {
+            return "";
+        }
+        return Md5Utils.md5(data);
+    }
+}
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskInterface.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskInterface.java
new file mode 100644
index 000000000..b89c340a9
--- /dev/null
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskInterface.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.plugin.logging.common.datamask;
+
+/**
+ * dataMask interface.
+ */
+public interface DataMaskInterface {
+
+    /**
+     * mask data.
+     *
+     * @param data data
+     * @return masked data
+     */
+    String mask(String data);
+}
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/datamask/KeyWordMatch.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/datamask/KeyWordMatch.java
new file mode 100644
index 000000000..bc3e8b737
--- /dev/null
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/datamask/KeyWordMatch.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.plugin.logging.common.datamask;
+
+import java.util.Set;
+import java.util.regex.Pattern;
+
+/**
+ * according input keyWord generate regex.
+ */
+public class KeyWordMatch {
+
+    private Pattern p;
+
+    /**
+     * generate regex.
+     *
+     * @param keyWordSet keyWord set
+     */
+    public KeyWordMatch(final Set<String> keyWordSet) {
+
+        StringBuilder sb = new StringBuilder();
+        keyWordSet.forEach(tempKeyWord -> {
+            sb.append("(?i)");
+            if (tempKeyWord.length() <= 6) {
+                sb.append(tempKeyWord);
+            } else {
+                sb.append("^" + tempKeyWord.substring(0, 3) + "(.*?)" + 
tempKeyWord.substring(tempKeyWord.length() - 3) + "$");
+            }
+            sb.append("||");
+        });
+        p = Pattern.compile(sb.toString());
+    }
+
+    /**
+     * according regex match keyWord.
+     *
+     * @param keyWord keyWord
+     * @return isMatch
+     */
+    public boolean matches(final String keyWord) {
+
+        return p.matcher(keyWord).matches();
+    }
+}
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/entity/ShenyuRequestLog.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/entity/ShenyuRequestLog.java
index 617069ab6..ad1b83699 100644
--- 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/entity/ShenyuRequestLog.java
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/entity/ShenyuRequestLog.java
@@ -40,15 +40,15 @@ public class ShenyuRequestLog {
 
     private String responseBody;
 
-    private int responseContentLength;
+    private Integer responseContentLength;
 
     private String rpcType;
 
-    private int status;
+    private Integer status;
 
     private String upstreamIp;
 
-    private long upstreamResponseTime;
+    private Long upstreamResponseTime;
 
     private String userAgent;
 
@@ -86,7 +86,7 @@ public class ShenyuRequestLog {
      *
      * @return ResponseContentLength
      */
-    public int getResponseContentLength() {
+    public Integer getResponseContentLength() {
         return responseContentLength;
     }
 
@@ -95,7 +95,7 @@ public class ShenyuRequestLog {
      *
      * @param responseContentLength ResponseContentLength
      */
-    public void setResponseContentLength(final int responseContentLength) {
+    public void setResponseContentLength(final Integer responseContentLength) {
         this.responseContentLength = responseContentLength;
     }
 
@@ -320,7 +320,7 @@ public class ShenyuRequestLog {
      *
      * @return status
      */
-    public int getStatus() {
+    public Integer getStatus() {
         return status;
     }
 
@@ -329,7 +329,7 @@ public class ShenyuRequestLog {
      *
      * @param status status
      */
-    public void setStatus(final int status) {
+    public void setStatus(final Integer status) {
         this.status = status;
     }
 
@@ -356,7 +356,7 @@ public class ShenyuRequestLog {
      *
      * @return upstreamResponseTime
      */
-    public long getUpstreamResponseTime() {
+    public Long getUpstreamResponseTime() {
         return upstreamResponseTime;
     }
 
@@ -365,7 +365,7 @@ public class ShenyuRequestLog {
      *
      * @param upstreamResponseTime upstreamResponseTime
      */
-    public void setUpstreamResponseTime(final long upstreamResponseTime) {
+    public void setUpstreamResponseTime(final Long upstreamResponseTime) {
         this.upstreamResponseTime = upstreamResponseTime;
     }
 
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/body/LoggingServerHttpResponseTest.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/body/LoggingServerHttpResponseTest.java
index 21952515a..2bd07ddc3 100644
--- 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/body/LoggingServerHttpResponseTest.java
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/body/LoggingServerHttpResponseTest.java
@@ -25,6 +25,8 @@ import org.apache.shenyu.plugin.api.utils.SpringBeanUtils;
 import org.apache.shenyu.plugin.base.utils.HostAddressUtils;
 import org.apache.shenyu.plugin.logging.common.collector.LogCollector;
 import org.apache.shenyu.plugin.logging.common.constant.GenericLoggingConstant;
+import org.apache.shenyu.plugin.logging.common.datamask.DataMaskByMD5;
+import org.apache.shenyu.plugin.logging.common.datamask.DataMaskInterface;
 import org.apache.shenyu.plugin.logging.common.entity.ShenyuRequestLog;
 import org.apache.shenyu.plugin.logging.common.utils.LogCollectUtils;
 import org.junit.jupiter.api.Assertions;
@@ -44,6 +46,8 @@ import java.net.URI;
 import java.nio.ByteBuffer;
 import java.nio.charset.StandardCharsets;
 import java.time.LocalDateTime;
+import java.util.HashSet;
+import java.util.Set;
 
 import static org.mockito.Mockito.mock;
 
@@ -53,11 +57,11 @@ import static org.mockito.Mockito.mock;
 public class LoggingServerHttpResponseTest {
 
     private final ShenyuRequestLog requestInfo = new ShenyuRequestLog();
-    
+
     private final LocalDateTime startDateTime = LocalDateTime.now();
-    
+
     private ServerWebExchange exchange;
-    
+
     private LoggingServerHttpResponse loggingServerHttpResponse;
 
     private LogCollector logCollector;
@@ -94,7 +98,10 @@ public class LoggingServerHttpResponseTest {
         
requestInfo.setUserAgent(serverHttpRequest.getHeaders().getFirst(GenericLoggingConstant.USER_AGENT));
         
requestInfo.setHost(serverHttpRequest.getHeaders().getFirst(GenericLoggingConstant.HOST));
         requestInfo.setPath(serverHttpRequest.getURI().getPath());
-        this.loggingServerHttpResponse = new 
LoggingServerHttpResponse(exchange.getResponse(), requestInfo, logCollector);
+        Set<String> keyWordSet = new HashSet<>();
+        DataMaskInterface dataMaskInterface = new DataMaskByMD5();
+        this.loggingServerHttpResponse = new 
LoggingServerHttpResponse(exchange.getResponse(), requestInfo,
+                logCollector, false, keyWordSet, dataMaskInterface);
     }
 
     @Test
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskByCharReplaceTest.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskByCharReplaceTest.java
new file mode 100644
index 000000000..1af5968ea
--- /dev/null
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskByCharReplaceTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.plugin.logging.common.datamask;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class DataMaskByCharReplaceTest {
+
+    private DataMaskByCharReplace dataMaskByCharReplace;
+
+    @BeforeEach
+    void setUp() {
+
+        dataMaskByCharReplace = new DataMaskByCharReplace();
+    }
+
+    @Test
+    void mask() {
+
+        String maskData = "123456789";
+        String mask = dataMaskByCharReplace.mask(maskData);
+        int maskNum = 0;
+        for (char c : mask.toCharArray()) {
+            if (c == '*') {
+                maskNum++;
+            }
+        }
+        Assertions.assertEquals(maskData.length() / 2, maskNum);
+        String nullMask = dataMaskByCharReplace.mask("");
+        Assertions.assertEquals("", nullMask);
+        String oneMask = dataMaskByCharReplace.mask("1");
+        Assertions.assertEquals("*", oneMask);
+    }
+}
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskByMD5Test.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskByMD5Test.java
new file mode 100644
index 000000000..7b96945bd
--- /dev/null
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/datamask/DataMaskByMD5Test.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.plugin.logging.common.datamask;
+
+import org.apache.shenyu.common.utils.Md5Utils;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class DataMaskByMD5Test {
+
+    private DataMaskByMD5 dataMaskByMD5;
+
+    @BeforeEach
+    void setUp() {
+
+        dataMaskByMD5 = new DataMaskByMD5();
+    }
+
+    @Test
+    void mask() {
+
+        String maskData = "123456789";
+        String mask = dataMaskByMD5.mask(maskData);
+        Assertions.assertEquals(Md5Utils.md5(maskData), mask);
+        String nullMask = dataMaskByMD5.mask("");
+        Assertions.assertEquals("", nullMask);
+    }
+}
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/datamask/KeyWordMatchTest.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/datamask/KeyWordMatchTest.java
new file mode 100644
index 000000000..914673e33
--- /dev/null
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/datamask/KeyWordMatchTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.plugin.logging.common.datamask;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+class KeyWordMatchTest {
+
+    private KeyWordMatch keyWordMatch;
+
+    @BeforeEach
+    void setUp() {
+
+        Set<String> set = new HashSet<>();
+        set.add("name");
+        set.add("TesT");
+        set.add("dsadsader");
+        keyWordMatch = new KeyWordMatch(set);
+    }
+
+    @Test
+    void matches() {
+
+        Assertions.assertTrue(keyWordMatch.matches("name"));
+        Assertions.assertTrue(keyWordMatch.matches("test"));
+        Assertions.assertFalse(keyWordMatch.matches("dsaer"));
+    }
+}
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/entity/ShenyuRequestLogTest.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/entity/ShenyuRequestLogTest.java
index 45ca50e68..21bcc6932 100644
--- 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/entity/ShenyuRequestLogTest.java
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/entity/ShenyuRequestLogTest.java
@@ -110,7 +110,7 @@ public class ShenyuRequestLogTest {
 
     @Test
     public void testUpstreamResponseTime() {
-        shenyuRequestLog.setUpstreamResponseTime(111111);
+        shenyuRequestLog.setUpstreamResponseTime(111111L);
         Assertions.assertEquals(shenyuRequestLog.getUpstreamResponseTime(), 
111111);
     }
 
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/utils/LogCollectConfigUtilsTest.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/utils/LogCollectConfigUtilsTest.java
index b7ac2f3f8..5e9b7a6a7 100644
--- 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/utils/LogCollectConfigUtilsTest.java
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/test/java/org/apache/shenyu/plugin/logging/common/utils/LogCollectConfigUtilsTest.java
@@ -35,9 +35,9 @@ import java.net.InetSocketAddress;
 import java.util.HashMap;
 import java.util.Map;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * The Test Case For LogCollectConfigUtils.
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-console/pom.xml 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-console/pom.xml
index 23eb535ea..6985afa5f 100644
--- a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-console/pom.xml
+++ b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-console/pom.xml
@@ -32,6 +32,11 @@
             <artifactId>shenyu-plugin-base</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shenyu</groupId>
+            <artifactId>shenyu-plugin-logging-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-test</artifactId>
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-console/src/main/java/org/apache/shenyu/plugin/logging/console/LoggingConsolePlugin.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-console/src/main/java/org/apache/shenyu/plugin/logging/console/LoggingConsolePlugin.java
index ddaf3ac67..ac89c9195 100644
--- 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-console/src/main/java/org/apache/shenyu/plugin/logging/console/LoggingConsolePlugin.java
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-console/src/main/java/org/apache/shenyu/plugin/logging/console/LoggingConsolePlugin.java
@@ -21,8 +21,13 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.shenyu.common.dto.RuleData;
 import org.apache.shenyu.common.dto.SelectorData;
 import org.apache.shenyu.common.enums.PluginEnum;
+import org.apache.shenyu.common.utils.JsonUtils;
 import org.apache.shenyu.plugin.api.ShenyuPluginChain;
+import org.apache.shenyu.plugin.api.utils.SpringBeanUtils;
 import org.apache.shenyu.plugin.base.AbstractShenyuPlugin;
+import org.apache.shenyu.plugin.logging.common.constant.GenericLoggingConstant;
+import org.apache.shenyu.plugin.logging.common.datamask.DataMaskInterface;
+import org.apache.shenyu.plugin.logging.common.datamask.KeyWordMatch;
 import org.reactivestreams.Publisher;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,8 +49,11 @@ import java.nio.ByteBuffer;
 import java.nio.channels.Channels;
 import java.nio.channels.WritableByteChannel;
 import java.nio.charset.StandardCharsets;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -56,47 +64,76 @@ import java.util.concurrent.atomic.AtomicBoolean;
 public class LoggingConsolePlugin extends AbstractShenyuPlugin {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(LoggingConsolePlugin.class);
-    
+
+    private static boolean maskFlag;
+
+    private static Set<String> keyWordSet = new HashSet<>();
+
+    private static DataMaskInterface dataMaskInterface;
+
+    private static KeyWordMatch keyWordMatch;
+
     @Override
     protected Mono<Void> doExecute(final ServerWebExchange exchange, final 
ShenyuPluginChain chain, final SelectorData selector, final RuleData rule) {
+
+        Map<String, String> handleMap = JsonUtils
+                
.jsonToMap(Optional.ofNullable(rule).map(RuleData::getHandle).orElse(""), 
String.class);
+        String keyWords = handleMap.get("keyword");
+        maskFlag = StringUtils.isNotBlank(keyWords) && 
"true".equals(handleMap.get("maskStatus")) ? true : false;
+        if (maskFlag) {
+            Collections.addAll(keyWordSet, keyWords.split(";"));
+            dataMaskInterface = 
SpringBeanUtils.getInstance().getBean(handleMap.get("maskType"));
+            keyWordMatch = new KeyWordMatch(keyWordSet);
+        }
         ServerHttpRequest request = exchange.getRequest();
-        StringBuilder requestInfo = new StringBuilder("Print Request Info: 
").append(System.lineSeparator());
+        //"Print Request Info: "
+        StringBuilder requestInfo = new 
StringBuilder().append(System.lineSeparator());
         
requestInfo.append(getRequestUri(request)).append(getRequestMethod(request)).append(System.lineSeparator())
                 
.append(getRequestHeaders(request)).append(System.lineSeparator())
                 
.append(getQueryParams(request)).append(System.lineSeparator());
         return chain.execute(exchange.mutate().request(new 
LoggingServerHttpRequest(request, requestInfo))
                 .response(new 
LoggingServerHttpResponse(exchange.getResponse(), requestInfo)).build());
     }
-    
+
     @Override
     public int getOrder() {
         return PluginEnum.LOGGING_CONSOLE.getCode();
     }
-    
+
     @Override
     public String named() {
         return PluginEnum.LOGGING_CONSOLE.getName();
     }
-    
+
     private String getRequestMethod(final ServerHttpRequest request) {
-        return "Request Method: " + request.getMethod() + 
System.lineSeparator();
+
+        String requestMethod = maskFlag && 
keyWordMatch.matches(GenericLoggingConstant.REQUEST_METHOD)
+                ? dataMaskInterface.mask(request.getMethod().toString()) : 
request.getMethod().toString();
+        return "Request Method: " + requestMethod + System.lineSeparator();
     }
-    
+
     private String getRequestUri(final ServerHttpRequest request) {
-        return "Request Uri: " + request.getURI() + System.lineSeparator();
+
+        String requestUri = maskFlag && 
keyWordMatch.matches(GenericLoggingConstant.REQUEST_URI)
+                ? dataMaskInterface.mask(request.getURI().toString()) : 
request.getURI().toString();
+        return "Request Uri: " + requestUri + System.lineSeparator();
     }
-    
+
     private String getQueryParams(final ServerHttpRequest request) {
         MultiValueMap<String, String> params = request.getQueryParams();
         StringBuilder logInfo = new StringBuilder();
         if (!params.isEmpty()) {
             logInfo.append("[Query Params 
Start]").append(System.lineSeparator());
-            params.forEach((key, value) -> logInfo.append(key).append(": 
").append(StringUtils.join(value, ",")).append(System.lineSeparator()));
+            params.forEach((key, value) -> {
+                maskList(key, value);
+                logInfo.append(key).append(": ")
+                        .append(StringUtils.join(value, 
",")).append(System.lineSeparator());
+            });
             logInfo.append("[Query Params 
End]").append(System.lineSeparator());
         }
         return logInfo.toString();
     }
-    
+
     private String getRequestHeaders(final ServerHttpRequest request) {
         HttpHeaders headers = request.getHeaders();
         final StringBuilder logInfo = new StringBuilder();
@@ -107,22 +144,45 @@ public class LoggingConsolePlugin extends 
AbstractShenyuPlugin {
         }
         return logInfo.toString();
     }
-    
+
     private void print(final String info) {
         LOG.info(info);
     }
-    
+
     private String getHeaders(final HttpHeaders headers) {
-        StringBuilder sb = new StringBuilder();
+        StringBuilder logInfo = new StringBuilder();
         Set<Map.Entry<String, List<String>>> entrySet = headers.entrySet();
         entrySet.forEach(entry -> {
             String key = entry.getKey();
             List<String> value = entry.getValue();
-            sb.append(key).append(": ").append(StringUtils.join(value, 
",")).append(System.lineSeparator());
+            maskList(key, value);
+            logInfo.append(key).append(": ").append(StringUtils.join(value, 
",")).append(System.lineSeparator());
         });
-        return sb.toString();
+        return logInfo.toString();
+    }
+
+    private static String maskOutput(final String output) {
+
+        Map<String, String> body = JsonUtils.jsonToMap(output, String.class);
+        if (maskFlag) {
+            body.forEach((key, value) -> {
+                if (keyWordMatch.matches(key)) {
+                    body.put(key, dataMaskInterface.mask(value));
+                }
+            });
+        }
+        return JsonUtils.toJson(body);
+    }
+
+    private static void maskList(final String key, final List<String> value) {
+
+        if (maskFlag && keyWordMatch.matches(key)) {
+            for (int i = 0; i < value.size(); i++) {
+                value.set(i, dataMaskInterface.mask(value.get(i)));
+            }
+        }
     }
-    
+
     static class LoggingServerHttpRequest extends ServerHttpRequestDecorator {
 
         private final StringBuilder logInfo;
@@ -139,7 +199,8 @@ public class LoggingConsolePlugin extends 
AbstractShenyuPlugin {
             return super.getBody().doOnNext(dataBuffer -> 
writer.write(dataBuffer.asByteBuffer().asReadOnlyBuffer())).doFinally(signal -> 
{
                 if (!writer.isEmpty()) {
                     logInfo.append("[Request Body 
Start]").append(System.lineSeparator());
-                    
logInfo.append(writer.output()).append(System.lineSeparator());
+                    String requestBody = maskOutput(writer.output());
+                    logInfo.append(requestBody).append(System.lineSeparator());
                     logInfo.append("[Request Body 
End]").append(System.lineSeparator());
                 } else {
                     // close writer when output.
@@ -176,7 +237,8 @@ public class LoggingConsolePlugin extends 
AbstractShenyuPlugin {
             BodyWriter writer = new BodyWriter();
             return Flux.from(body).doOnNext(buffer -> 
writer.write(buffer.asByteBuffer().asReadOnlyBuffer())).doFinally(signal -> {
                 logInfo.append("[Response Body 
Start]").append(System.lineSeparator());
-                logInfo.append(writer.output()).append(System.lineSeparator());
+                String responseBody = maskOutput(writer.output());
+                logInfo.append(responseBody).append(System.lineSeparator());
                 logInfo.append("[Response Body 
End]").append(System.lineSeparator());
                 // when response, print all request info.
                 print(logInfo.toString());
@@ -185,8 +247,8 @@ public class LoggingConsolePlugin extends 
AbstractShenyuPlugin {
 
         private String getResponseHeaders() {
             return System.lineSeparator() + "[Response Headers Start]" + 
System.lineSeparator()
-                + 
LoggingConsolePlugin.this.getHeaders(serverHttpResponse.getHeaders())
-                + "[Response Headers End]" + System.lineSeparator();
+                    + 
LoggingConsolePlugin.this.getHeaders(serverHttpResponse.getHeaders())
+                    + "[Response Headers End]" + System.lineSeparator();
         }
     }
 
diff --git 
a/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-console/src/main/java/org/apache/shenyu/plugin/logging/console/config/DataMaskConfig.java
 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-console/src/main/java/org/apache/shenyu/plugin/logging/console/config/DataMaskConfig.java
new file mode 100644
index 000000000..a28e4a414
--- /dev/null
+++ 
b/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-console/src/main/java/org/apache/shenyu/plugin/logging/console/config/DataMaskConfig.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.plugin.logging.console.config;
+
+import org.apache.shenyu.plugin.logging.common.datamask.DataMaskByCharReplace;
+import org.apache.shenyu.plugin.logging.common.datamask.DataMaskByMD5;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class DataMaskConfig {
+
+    /**
+     * config bean.
+     *
+     * @return dataMaskByCharReplace bean
+     */
+    @Bean
+    public DataMaskByCharReplace dataMaskByCharReplace() {
+        return new DataMaskByCharReplace();
+    }
+
+    /**
+     * config bean.
+     *
+     * @return dataMaskByMD5 bean
+     */
+    @Bean
+    public DataMaskByMD5 dataMaskByMD5() {
+        return new DataMaskByMD5();
+    }
+}


Reply via email to