You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by pa...@apache.org on 2016/05/03 19:50:47 UTC
[4/5] drill git commit: DRILL-4584: JDBC/ODBC Client IP in Drill
audit logs - the format of added field in log files is
"remoteAddress":"192.168.121.1:58984"
DRILL-4584: JDBC/ODBC Client IP in Drill audit logs - the format of added field in log files is "remoteAddress":"192.168.121.1:58984"
This closes #475
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/2d9f9abb
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/2d9f9abb
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/2d9f9abb
Branch: refs/heads/master
Commit: 2d9f9abb4c47d08f8462599c8d6076a61a1708fe
Parents: a6a85ab
Author: Vitalii Diravka <vi...@gmail.com>
Authored: Fri Apr 8 11:01:37 2016 +0300
Committer: Parth Chandra <pa...@apache.org>
Committed: Tue May 3 10:50:09 2016 -0700
----------------------------------------------------------------------
.../java/org/apache/drill/exec/work/foreman/Foreman.java | 3 ++-
.../org/apache/drill/exec/work/foreman/LoggedQuery.java | 10 +++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/2d9f9abb/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
index 1464cad..29c7971 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
@@ -687,7 +687,8 @@ public class Foreman implements Runnable {
new Date(queryContext.getQueryContextInfo().getQueryStartTime()),
new Date(System.currentTimeMillis()),
state,
- queryContext.getSession().getCredentials().getUserName());
+ queryContext.getSession().getCredentials().getUserName(),
+ initiatingClient.getChannel().remoteAddress());
queryLogger.info(MAPPER.writeValueAsString(q));
} catch (Exception e) {
logger.error("Failure while recording query information to query log.", e);
http://git-wip-us.apache.org/repos/asf/drill/blob/2d9f9abb/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/LoggedQuery.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/LoggedQuery.java b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/LoggedQuery.java
index f856d53..4248595 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/LoggedQuery.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/LoggedQuery.java
@@ -17,6 +17,7 @@
*/
package org.apache.drill.exec.work.foreman;
+import java.net.SocketAddress;
import java.util.Date;
import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
@@ -33,9 +34,11 @@ public class LoggedQuery {
private final Date finish;
private final QueryState outcome;
private final String username;
+ private final SocketAddress remoteAddress;
+
public LoggedQuery(String queryId, String schema, String queryText, Date start, Date finish, QueryState outcome,
- String username) {
+ String username, SocketAddress remoteAddress) {
super();
this.queryId = queryId;
this.schema = schema;
@@ -44,6 +47,7 @@ public class LoggedQuery {
this.finish = finish;
this.outcome = outcome;
this.username = username;
+ this.remoteAddress = remoteAddress;
}
@JsonProperty("id")
@@ -77,4 +81,8 @@ public class LoggedQuery {
return username;
}
+ public String getRemoteAddress() {
+ return remoteAddress.toString().replace("/","");
+ }
+
}