HDFS-16925. Namenode audit log to only include IP address of client (#5413)

Reviewed-by: Takanobu Asanuma <tasanuma@apache.org>
Signed-off-by: Tao Li <tomscut@apache.org>
This commit is contained in:
Viraj Jasani 2023-02-20 16:33:54 -08:00 committed by GitHub
parent 477f17be97
commit e47ff5f3c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8506,9 +8506,10 @@ public void logAuditEvent(boolean succeeded, String userName,
src = escapeJava(src); src = escapeJava(src);
dst = escapeJava(dst); dst = escapeJava(dst);
sb.setLength(0); sb.setLength(0);
String ipAddr = addr != null ? "/" + addr.getHostAddress() : "null";
sb.append("allowed=").append(succeeded).append("\t") sb.append("allowed=").append(succeeded).append("\t")
.append("ugi=").append(userName).append("\t") .append("ugi=").append(userName).append("\t")
.append("ip=").append(addr).append("\t") .append("ip=").append(ipAddr).append("\t")
.append("cmd=").append(cmd).append("\t") .append("cmd=").append(cmd).append("\t")
.append("src=").append(src).append("\t") .append("src=").append(src).append("\t")
.append("dst=").append(dst).append("\t"); .append("dst=").append(dst).append("\t");