ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sneet...@apache.org
Subject [3/7] incubator-ranger git commit: ARGUS-182: updated date field format in the audit record saved to HDFS file, to enable easier loading into Hive. Also revised the name of the JSON keys to make it easier to read/understand and also to save few bytes per
Date Tue, 09 Dec 2014 23:42:28 GMT
ARGUS-182: updated date field format in the audit record saved to HDFS
file, to enable easier loading into Hive. Also revised the name of the
JSON keys to make it easier to read/understand and also to save few
bytes per record.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/0895239f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/0895239f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/0895239f

Branch: refs/heads/ranger-0.4
Commit: 0895239f088e7a0903edfbab11029f3840006ae1
Parents: 57b8dbd
Author: Madhan Neethiraj <madhan@apache.org>
Authored: Wed Nov 12 23:14:37 2014 -0800
Committer: sneethiraj <sneethir@apache.org>
Committed: Sun Dec 7 01:13:21 2014 -0500

----------------------------------------------------------------------
 .../xasecure/audit/model/AuditEventBase.java    | 37 ++++++++++++++++++--
 .../xasecure/audit/model/HBaseAuditEvent.java   | 10 +++++-
 .../xasecure/audit/model/HdfsAuditEvent.java    |  5 +++
 .../xasecure/audit/model/HiveAuditEvent.java    |  6 ++++
 .../xasecure/audit/model/KnoxAuditEvent.java    |  7 +++-
 .../xasecure/audit/model/StormAuditEvent.java   |  7 +++-
 .../com/xasecure/audit/provider/MiscUtil.java   |  2 +-
 7 files changed, 68 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java b/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java
index 4fd56be..be066de 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/AuditEventBase.java
@@ -20,10 +20,10 @@
  package com.xasecure.audit.model;
 
 import java.util.Date;
-import java.util.UUID;
 
-import com.xasecure.audit.dao.DaoManager;
+import com.google.gson.annotations.SerializedName;  
 
+import com.xasecure.audit.dao.DaoManager;
 
 
 public abstract class AuditEventBase {
@@ -33,22 +33,55 @@ public abstract class AuditEventBase {
 	protected static final int MAX_REQUEST_DATA_FIELD_SIZE = 1800 ;
 
 	
+	@SerializedName("agent")  
 	protected String agentId        = null;
+
+	@SerializedName("reqUser")  
 	protected String user           = null;
+
+	@SerializedName("evtTime")  
 	protected Date   eventTime      = new Date();
+
+	@SerializedName("policy")  
 	protected long   policyId       = 0;
+
+	@SerializedName("access")  
 	protected String accessType     = null;
+
+	@SerializedName("result")  
 	protected short  accessResult   = 0; // 0 - DENIED; 1 - ALLOWED; HTTP return code 
+
+	@SerializedName("reason")  
 	protected String resultReason   = null;
+
+	@SerializedName("enforcer")  
 	protected String aclEnforcer    = null;
+
+	@SerializedName("repoType")  
 	protected int    repositoryType = 0;
+
+	@SerializedName("repo")  
 	protected String repositoryName = null;
+
+	@SerializedName("sess")  
 	protected String sessionId      = null;
+
+	@SerializedName("cliType")  
 	protected String clientType     = null;
+
+	@SerializedName("cliIP")  
 	protected String clientIP       = null;
+
+	@SerializedName("action")  
 	protected String action         = null;
+
+	@SerializedName("agentHost")  
 	protected String agentHostname  = null;
+
+	@SerializedName("logType")  
 	protected String logType        = null;
+
+	@SerializedName("id")  
 	protected String eventId        = null;
 
 	protected AuditEventBase() {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java
index 47cf2a0..4a35ea4 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/HBaseAuditEvent.java
@@ -17,16 +17,24 @@
  * under the License.
  */
 
- package com.xasecure.audit.model;
+package com.xasecure.audit.model;
 
 import java.util.Date;
 
+import com.google.gson.annotations.SerializedName;  
+
 import com.xasecure.audit.dao.DaoManager;
 import com.xasecure.audit.entity.XXHBaseAuditEvent;
 
+
 public class HBaseAuditEvent extends AuditEventBase {
+	@SerializedName("resource")  
 	protected String resourcePath;
+
+	@SerializedName("resType")  
 	protected String resourceType;
+
+	@SerializedName("reqData")  
 	protected String requestData;
 
 	public HBaseAuditEvent() {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java
index 80f906b..b9a6870 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/HdfsAuditEvent.java
@@ -21,11 +21,16 @@
 
 import java.util.Date;
 
+import com.google.gson.annotations.SerializedName;  
+
 import com.xasecure.audit.dao.DaoManager;
 import com.xasecure.audit.entity.XXHdfsAuditEvent;
 
 public class HdfsAuditEvent extends AuditEventBase {
+	@SerializedName("resource")  
 	protected String resourcePath;
+
+	@SerializedName("resType")  
 	protected String resourceType;
 
 	public HdfsAuditEvent() {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java
index 261c804..5765bed 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/HiveAuditEvent.java
@@ -21,12 +21,18 @@
 
 import java.util.Date;
 
+import com.google.gson.annotations.SerializedName;  
 import com.xasecure.audit.dao.DaoManager;
 import com.xasecure.audit.entity.XXHiveAuditEvent;
 
 public class HiveAuditEvent extends AuditEventBase {
+	@SerializedName("resource")  
 	protected String resourcePath;
+
+	@SerializedName("resType")  
 	protected String resourceType;
+
+	@SerializedName("reqData")  
 	protected String requestData;
 
 	public HiveAuditEvent() {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java
index 545de1c..dd18057 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/KnoxAuditEvent.java
@@ -1,6 +1,6 @@
 package com.xasecure.audit.model;
 
-
+import com.google.gson.annotations.SerializedName;  
 import com.xasecure.audit.dao.DaoManager;
 import com.xasecure.audit.entity.XXKnoxAuditEvent;
 
@@ -22,8 +22,13 @@ import com.xasecure.audit.entity.XXKnoxAuditEvent;
  */
 
 public class KnoxAuditEvent extends AuditEventBase {
+	@SerializedName("resource")  
 	protected String resourcePath;
+
+	@SerializedName("resType")  
 	protected String resourceType;
+
+	@SerializedName("reqData")  
 	protected String requestData;
 
 	public KnoxAuditEvent() {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java b/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java
index 0dfcc39..f911068 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/model/StormAuditEvent.java
@@ -1,6 +1,6 @@
 package com.xasecure.audit.model;
 
-
+import com.google.gson.annotations.SerializedName;  
 import com.xasecure.audit.dao.DaoManager;
 import com.xasecure.audit.entity.XXStormAuditEvent;
 
@@ -22,8 +22,13 @@ import com.xasecure.audit.entity.XXStormAuditEvent;
  */
 
 public class StormAuditEvent extends AuditEventBase {
+	@SerializedName("resource")  
 	protected String resourcePath;
+
+	@SerializedName("resType")  
 	protected String resourceType;
+
+	@SerializedName("reqData")  
 	protected String requestData;
 
 	public StormAuditEvent() {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0895239f/agents-audit/src/main/java/com/xasecure/audit/provider/MiscUtil.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/MiscUtil.java b/agents-audit/src/main/java/com/xasecure/audit/provider/MiscUtil.java
index 54341dd..872420e 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/provider/MiscUtil.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/provider/MiscUtil.java
@@ -47,7 +47,7 @@ public class MiscUtil {
 
 	static {
 		try {
-			sGsonBuilder = new GsonBuilder().setDateFormat("yyyyMMdd-HH:mm:ss.SSS-Z").create();
+			sGsonBuilder = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss.SSS").create();
 		} catch(Throwable excp) {
 			LogLog.warn("failed to create GsonBuilder object. stringigy() will return obj.toString(),
instead of Json", excp);
 		}


Mime
View raw message