From 7743260accd7f05b037602868e7fccd77d964e72 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Thu, 19 Jul 2012 00:10:28 +0000 Subject: [PATCH] HBASE-6373 Add more context information to audit log messages git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1363188 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop/hbase/security/access/AccessController.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java index 5d89efdc7f2..2007299fad7 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java @@ -15,6 +15,7 @@ package org.apache.hadoop.hbase.security.access; import java.io.IOException; +import java.net.InetAddress; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; @@ -339,9 +340,15 @@ public class AccessController extends BaseRegionObserver private void logResult(AuthResult result) { if (AUDITLOG.isTraceEnabled()) { + InetAddress remoteAddr = null; + RequestContext ctx = RequestContext.get(); + if (ctx != null) { + remoteAddr = ctx.getRemoteAddress(); + } AUDITLOG.trace("Access " + (result.isAllowed() ? "allowed" : "denied") + " for user " + (result.getUser() != null ? result.getUser().getShortName() : "UNKNOWN") + "; reason: " + result.getReason() + + "; remote address: " + (remoteAddr != null ? remoteAddr : "") + "; context: " + result.toContextString()); } }