From e14ec57eee9a6898abc036b6010d52e7e440c22e Mon Sep 17 00:00:00 2001 From: lujiefsi Date: Thu, 1 Apr 2021 07:12:31 +0800 Subject: [PATCH] HBASE-25558:Adding audit log for execMasterService (#3101) Signed-off-by: stack --- .../org/apache/hadoop/hbase/master/MasterRpcServices.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java index 21239db9f3d..f5c6441c8d5 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java @@ -963,6 +963,12 @@ public class MasterRpcServices extends RSRpcServices implements if (execController.getFailedOn() != null) { throw execController.getFailedOn(); } + + String remoteAddress = RpcServer.getRemoteAddress().map(InetAddress::toString).orElse(""); + User caller = RpcServer.getRequestUser().orElse(null); + AUDITLOG.info("User {} (remote address: {}) master service request for {}.{}", caller, + remoteAddress, serviceName, methodName); + return CoprocessorRpcUtils.getResponse(execResult, HConstants.EMPTY_BYTE_ARRAY); } catch (IOException ie) { throw new ServiceException(ie);