From 3234154689d78e530967796f58440e490a1a1028 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 9f7974e8998..963997a123c 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 @@ -930,6 +930,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);