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
This commit is contained in:
parent
dc17a2559c
commit
7743260acc
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue