ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject incubator-argus 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 record
Date Thu, 13 Nov 2014 07:26:19 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/master 17bcc918f -> eba80f704


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-argus/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-argus/commit/eba80f70
Tree: http://git-wip-us.apache.org/repos/asf/incubator-argus/tree/eba80f70
Diff: http://git-wip-us.apache.org/repos/asf/incubator-argus/diff/eba80f70

Branch: refs/heads/master
Commit: eba80f70458d9dd0275a23ef661d6725d5fd9c27
Parents: 17bcc91
Author: Madhan Neethiraj <madhan@apache.org>
Authored: Wed Nov 12 23:14:37 2014 -0800
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Wed Nov 12 23:14:37 2014 -0800

----------------------------------------------------------------------
 .../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-argus/blob/eba80f70/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-argus/blob/eba80f70/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-argus/blob/eba80f70/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-argus/blob/eba80f70/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-argus/blob/eba80f70/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-argus/blob/eba80f70/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-argus/blob/eba80f70/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