You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2014/09/25 10:27:21 UTC

[1/3] git commit: ARGUS-5: added support for %app-type% token in file and directory names, to enable configuration of separate log directories for HBase Master and Regional servers, HiveServer2 and HiveCLI. Audit framework initialization call deferred to

Repository: incubator-argus
Updated Branches:
  refs/heads/master 674c615dd -> 7a01fbbe2


ARGUS-5: added support for %app-type% token in file and directory names,
to enable configuration of separate log directories for HBase Master and
Regional servers, HiveServer2 and HiveCLI. Audit framework
initialization call deferred to a point where the application-type
information is available.

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

Branch: refs/heads/master
Commit: fcf01f981bf810d868f15b65b5d7b802851e3cf4
Parents: 4058fd2
Author: mneethiraj <mn...@hortonworks.com>
Authored: Wed Sep 24 22:57:23 2014 -0700
Committer: mneethiraj <mn...@hortonworks.com>
Committed: Wed Sep 24 22:57:23 2014 -0700

----------------------------------------------------------------------
 .../audit/provider/AuditProviderFactory.java    |  58 ++++++-
 .../audit/provider/LocalFileLogBuffer.java      |   2 +-
 .../com/xasecure/audit/provider/MiscUtil.java   | 152 +++++++++++++------
 .../audit/provider/hdfs/HdfsLogDestination.java |   2 +-
 .../com/xasecure/audit/test/TestEvents.java     |   3 +-
 .../hadoop/config/XaSecureConfiguration.java    |  30 ++--
 .../pdp/knox/filter/XASecurePDPKnoxFilter.java  |   4 +
 .../hbase/XaSecureAuthorizationCoprocessor.java |  12 +-
 .../namenode/XaSecureFSPermissionChecker.java   |   4 +-
 .../hive/authorizer/XaSecureHiveAuthorizer.java |  18 +++
 .../authorizer/XaSecureStormAuthorizer.java     |   7 +-
 11 files changed, 221 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/fcf01f98/agents-audit/src/main/java/com/xasecure/audit/provider/AuditProviderFactory.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/AuditProviderFactory.java b/agents-audit/src/main/java/com/xasecure/audit/provider/AuditProviderFactory.java
index bb31e7c..814026d 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/provider/AuditProviderFactory.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/provider/AuditProviderFactory.java
@@ -40,6 +40,8 @@ import com.xasecure.authorization.hadoop.utils.XaSecureCredentialProvider;
 
 public class AuditProviderFactory {
 
+	public enum ApplicationType { Unknown, Hdfs, HiveCLI, HiveServer2, HBaseMaster, HBaseRegionalServer, Knox, Storm };
+
 	private static final Log LOG = LogFactory.getLog(AuditProviderFactory.class);
 
 	private static final String AUDIT_IS_ENABLED_PROP               = "xasecure.audit.is.enabled" ;
@@ -71,6 +73,7 @@ public class AuditProviderFactory {
 	private static AuditProviderFactory sFactory;
 
 	private AuditProvider mProvider = null;
+	private boolean       mInitDone = false;
 
 	private AuditProviderFactory() {
 		LOG.info("AuditProviderFactory: creating..");
@@ -98,8 +101,21 @@ public class AuditProviderFactory {
 		return mProvider;
 	}
 
-	public void init(Properties props) {
+	public boolean isInitDone() {
+		return mInitDone;
+	}
+
+	public synchronized void init(Properties props, ApplicationType appType) {
 		LOG.info("AuditProviderFactory: initializing..");
+		
+		if(mInitDone) {
+			LOG.warn("AuditProviderFactory.init(): already initialized!", new Exception());
+
+			return;
+		}
+		mInitDone = true;
+		
+		setApplicationType(appType);
 
 		boolean isEnabled             = getBooleanProperty(props, AUDIT_IS_ENABLED_PROP, false);
 		boolean isAuditToDbEnabled    = getBooleanProperty(props, AUDIT_DB_IS_ENABLED_PROP, false);
@@ -228,6 +244,46 @@ public class AuditProviderFactory {
 
 	    Runtime.getRuntime().addShutdownHook(jvmShutdownHook);
 	}
+
+	private static void setApplicationType(ApplicationType appType) {
+		String strAppType = null;
+
+		switch(appType) {
+			case Hdfs:
+				strAppType = "hdfs";
+			break;
+	
+			case HiveCLI:
+				strAppType = "hiveCli";
+			break;
+	
+			case HiveServer2:
+				strAppType = "hiveServer2";
+			break;
+	
+			case HBaseMaster:
+				strAppType = "hbaseMaster";
+			break;
+
+			case HBaseRegionalServer:
+				strAppType = "hbaseRegional";
+			break;
+
+			case Knox:
+				strAppType = "knox";
+			break;
+
+			case Storm:
+				strAppType = "storm";
+			break;
+
+			case Unknown:
+				strAppType = "unknown";
+			break;
+		}
+
+		MiscUtil.setApplicationType(strAppType);
+	}
 	
 	private Map<String, String> getPropertiesWithPrefix(Properties props, String prefix) {
 		Map<String, String> prefixedProperties = new HashMap<String, String>();

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/fcf01f98/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java b/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java
index 767cbc4..fc53ba6 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java
@@ -408,7 +408,7 @@ class DestinationDispatcherThread<T> extends Thread {
 					try {
 						mCompletedLogfiles.wait(pollIntervalInMs);
 					} catch(InterruptedException excp) {
-						LogLog.warn("LocalFileLogBuffer.run(): failed to wait for log file", excp);
+						LogLog.warn("DestinationDispatcherThread.run(): failed to wait for log file", excp);
 					}
 				}
 				

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/fcf01f98/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 d382ead..9ad3db9 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
@@ -12,17 +12,22 @@ import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 
 public class MiscUtil {
-	public static final String TOKEN_HOSTNAME     = "%hostname%";
-	public static final String TOKEN_JVM_INSTANCE = "%jvm-instance%";
-	public static final String TOKEN_TIME_START   = "%time:";
-	public static final String TOKEN_TIME_END     = "%";
-	public static final String ESCAPE_STR         = "\\";
+	public static final String TOKEN_START        = "%";
+	public static final String TOKEN_END          = "%";
+	public static final String TOKEN_HOSTNAME     = "hostname";
+	public static final String TOKEN_APP_TYPE     = "app-type";
+	public static final String TOKEN_JVM_INSTANCE = "jvm-instance";
+	public static final String TOKEN_TIME         = "time:";
+	public static final String TOKEN_PROPERTY     = "property:";
+	public static final String TOKEN_ENV          = "env:";
+	public static final String ESCAPE_STR           = "\\";
 
 	static VMID sJvmID = new VMID();
 
 	public static String LINE_SEPARATOR = System.getProperty("line.separator");
 
-	private static Gson sGsonBuilder = null;
+	private static Gson   sGsonBuilder = null;
+	private static String sApplicationType = null;
 
 	static {
 		try {
@@ -37,71 +42,122 @@ public class MiscUtil {
 			return str;
 		}
 
-		str = replaceHostname(str);
-		str = replaceJvmInstance(str);
-		str = replaceTime(str, time);
+		if(time <= 0) {
+			time = System.currentTimeMillis();
+		}
 
-		return str;
-	}
+        for(int startPos = 0; startPos < str.length(); ) {
+            int tagStartPos = str.indexOf(TOKEN_START, startPos);
+            
+            if(tagStartPos == -1) {
+            	break;
+            }
 
-	public static String replaceHostname(String str) {
-		if(!str.contains(TOKEN_HOSTNAME)) {
-			return str;
-		}
+            int tagEndPos = str.indexOf(TOKEN_END, tagStartPos + TOKEN_START.length());
+
+            if(tagEndPos == -1) {
+            	break;
+            }
 
-		String hostName = null;
+            String tag   = str.substring(tagStartPos, tagEndPos+TOKEN_END.length());
+            String token = tag.substring(TOKEN_START.length(), tag.lastIndexOf(TOKEN_END));
+            String val   = "";
+
+            if(token != null) {
+	            if(token.equals(TOKEN_HOSTNAME)) {
+	            	val = getHostname();
+	            } else if(token.equals(TOKEN_APP_TYPE)) {
+	            	val = getApplicationType();
+	            } else if(token.equals(TOKEN_JVM_INSTANCE)) {
+	            	val = getJvmInstanceId();
+	            } else if(token.startsWith(TOKEN_PROPERTY)) {
+	            	String propertyName = token.substring(TOKEN_PROPERTY.length());
+	
+	                val = getSystemProperty(propertyName);
+	            } else if(token.startsWith(TOKEN_ENV)) {
+	            	String envName = token.substring(TOKEN_ENV.length());
+	
+	                val = getEnv(envName);
+	            } else if(token.startsWith(TOKEN_TIME)) {
+	                String dtFormat = token.substring(TOKEN_TIME.length());
+	                
+	                val = getFormattedTime(time, dtFormat);
+	            }
+            }
+
+            if(val == null) {
+            	val = "";
+            }
+
+            str = str.substring(0, tagStartPos) + val + str.substring(tagEndPos + TOKEN_END.length());
+            startPos = tagStartPos + val.length();
+        }
+
+        return str;
+	}
+
+	public static String getHostname() {
+		String ret = null;
 
 		try {
-			hostName = InetAddress.getLocalHost().getHostName();
+			ret = InetAddress.getLocalHost().getHostName();
 		} catch (UnknownHostException excp) {
-			LogLog.warn("replaceHostname()", excp);
+			LogLog.warn("getHostname()", excp);
 		}
 
-		if(hostName == null) {
-			hostName = "Unknown";
-		}
+		return ret;
+	}
 
-		return str.replace(TOKEN_HOSTNAME, hostName);
+	public static void setApplicationType(String applicationType) {
+		sApplicationType = applicationType;
+	}
+
+	public static String getApplicationType() {
+		return sApplicationType;
 	}
-	
-	public static String replaceJvmInstance(String str) {
-		if(!str.contains(TOKEN_JVM_INSTANCE)) {
-			return str;
-		}
 
-		String jvmInstance = Integer.toString(Math.abs(sJvmID.hashCode()));
+	public static String getJvmInstanceId() {
+		String ret = Integer.toString(Math.abs(sJvmID.toString().hashCode()));
 
-		return str.replace(TOKEN_JVM_INSTANCE, jvmInstance);
+		return ret;
 	}
 
-	public static String replaceTime(String str, long time) {
-		if(time <= 0) {
-			time = System.currentTimeMillis();
+	public static String getSystemProperty(String propertyName) {
+		String ret = null;
+
+		try {
+			ret = propertyName != null ? System.getProperty(propertyName) : null;
+		} catch (Exception excp) {
+			LogLog.warn("getSystemProperty(" + propertyName + ") failed", excp);
 		}
 
-        while(str.contains(TOKEN_TIME_START)) {
-            int tagStartPos = str.indexOf(TOKEN_TIME_START);
-            int tagEndPos   = str.indexOf(TOKEN_TIME_END, tagStartPos + TOKEN_TIME_START.length());
+		return ret;
+	}
 
-            if(tagEndPos <= tagStartPos) {
-            	break;
-            }
+	public static String getEnv(String envName) {
+		String ret = null;
 
-            String tag      = str.substring(tagStartPos, tagEndPos+1);
-            String dtFormat = tag.substring(TOKEN_TIME_START.length(), tag.lastIndexOf(TOKEN_TIME_END));
+		try {
+			ret = envName != null ? System.getenv(envName) : null;
+		} catch (Exception excp) {
+			LogLog.warn("getenv(" + envName + ") failed", excp);
+		}
 
-            String replaceStr = "";
+		return ret;
+	}
 
-            if(dtFormat != null) {
-                SimpleDateFormat sdf = new SimpleDateFormat(dtFormat);
+	public static String getFormattedTime(long time, String format) {
+		String ret = null;
 
-                replaceStr = sdf.format(time);
-            }
+		try {
+            SimpleDateFormat sdf = new SimpleDateFormat(format);
 
-            str = str.replace(tag, replaceStr);
-        }
+            ret = sdf.format(time);
+		} catch (Exception excp) {
+			LogLog.warn("SimpleDateFormat.format() failed: " + format, excp);
+		}
 
-        return str;
+		return ret;
 	}
 
 	public static void createParents(File file) {

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/fcf01f98/agents-audit/src/main/java/com/xasecure/audit/provider/hdfs/HdfsLogDestination.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/hdfs/HdfsLogDestination.java b/agents-audit/src/main/java/com/xasecure/audit/provider/hdfs/HdfsLogDestination.java
index 3c3a0a4..8872541 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/provider/hdfs/HdfsLogDestination.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/provider/hdfs/HdfsLogDestination.java
@@ -199,7 +199,7 @@ public class HdfsLogDestination<T> implements LogDestination<T> {
 						ostream = fileSystem.append(pathLogfile);
 					} catch(IOException excp) {
 						// append may not be supported by the filesystem. rename existing file and create a new one
-						String fileSuffix    = MiscUtil.replaceTokens("-" + MiscUtil.TOKEN_TIME_START + "yyyyMMdd-HHmm.ss" + MiscUtil.TOKEN_TIME_END, startTime);
+						String fileSuffix    = MiscUtil.replaceTokens("-" + MiscUtil.TOKEN_START + MiscUtil.TOKEN_TIME + "yyyyMMdd-HHmm.ss" + MiscUtil.TOKEN_END, startTime);
 						String movedFilename = appendToFilename(mHdfsFilename, fileSuffix);
 						Path   movedFilePath = new Path(movedFilename);
 

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/fcf01f98/agents-audit/src/main/java/com/xasecure/audit/test/TestEvents.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/test/TestEvents.java b/agents-audit/src/main/java/com/xasecure/audit/test/TestEvents.java
index 8968093..92497f7 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/test/TestEvents.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/test/TestEvents.java
@@ -35,6 +35,7 @@ import com.xasecure.audit.model.KnoxAuditEvent;
 import com.xasecure.audit.model.StormAuditEvent;
 import com.xasecure.audit.provider.AuditProvider;
 import com.xasecure.audit.provider.AuditProviderFactory;
+import com.xasecure.audit.provider.AuditProviderFactory.ApplicationType;
 
 public class TestEvents {
 
@@ -76,7 +77,7 @@ public class TestEvents {
 	        	auditProperties.setProperty("xasecure.audit.db.batch.size", "100");
         	}
         	
-        	AuditProviderFactory.getInstance().init(auditProperties);
+        	AuditProviderFactory.getInstance().init(auditProperties, ApplicationType.Hdfs);
 
         	AuditProvider provider = AuditProviderFactory.getAuditProvider();
 

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/fcf01f98/agents-common/src/main/java/com/xasecure/authorization/hadoop/config/XaSecureConfiguration.java
----------------------------------------------------------------------
diff --git a/agents-common/src/main/java/com/xasecure/authorization/hadoop/config/XaSecureConfiguration.java b/agents-common/src/main/java/com/xasecure/authorization/hadoop/config/XaSecureConfiguration.java
index e61da1b..e026b00 100644
--- a/agents-common/src/main/java/com/xasecure/authorization/hadoop/config/XaSecureConfiguration.java
+++ b/agents-common/src/main/java/com/xasecure/authorization/hadoop/config/XaSecureConfiguration.java
@@ -83,35 +83,37 @@ public class XaSecureConfiguration extends Configuration {
 				XaSecureConfiguration temp = config;
 				if (temp == null) {
 					config = new XaSecureConfiguration();
-					
-					onConfigInstantiation(config);
 				}
 			}
 		}
 		return config;
 	}
-	
-	private static void onConfigInstantiation(XaSecureConfiguration config) {
-		initAudit(config);
-	}
 
-	private static void initAudit(XaSecureConfiguration config) {
+	public void initAudit(AuditProviderFactory.ApplicationType appType) {
 		AuditProviderFactory auditFactory = AuditProviderFactory.getInstance();
-		
+
 		if(auditFactory == null) {
 			LOG.error("Unable to find the AuditProviderFactory. (null) found") ;
 			return;
 		}
-		
-		Properties props = config.getProps();
-		
+
+		Properties props = getProps();
+
 		if(props == null) {
 			return;
 		}
-		
-		auditFactory.init(props);
+
+		if(! auditFactory.isInitDone()) {
+			auditFactory.init(props, appType);
+		}
 	}
-	
+
+	public boolean isAuditInitDone() {
+		AuditProviderFactory auditFactory = AuditProviderFactory.getInstance();
+
+		return auditFactory != null && auditFactory.isInitDone();
+	}
+
 	
 	@SuppressWarnings("deprecation")
 	public  URL getXAAuditXMLFileLocation() {

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/fcf01f98/agents-impl/src/main/java/com/xasecure/pdp/knox/filter/XASecurePDPKnoxFilter.java
----------------------------------------------------------------------
diff --git a/agents-impl/src/main/java/com/xasecure/pdp/knox/filter/XASecurePDPKnoxFilter.java b/agents-impl/src/main/java/com/xasecure/pdp/knox/filter/XASecurePDPKnoxFilter.java
index 92c0a4a..dfa68b5 100644
--- a/agents-impl/src/main/java/com/xasecure/pdp/knox/filter/XASecurePDPKnoxFilter.java
+++ b/agents-impl/src/main/java/com/xasecure/pdp/knox/filter/XASecurePDPKnoxFilter.java
@@ -61,6 +61,10 @@ public class XASecurePDPKnoxFilter implements Filter {
 
 	AuditProvider auditProvider = AuditProviderFactory.getAuditProvider();
 	private final String REPOSITORY_NAME = XaSecureConfiguration.getInstance().get(XaSecureHadoopConstants.AUDITLOG_REPOSITORY_NAME_PROP);
+	
+	static {
+		XaSecureConfiguration.getInstance().initAudit(AuditProviderFactory.ApplicationType.Knox);
+	}
 
 	@Override
 	public void init(FilterConfig filterConfig) throws ServletException {

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/fcf01f98/hbase-agent/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
----------------------------------------------------------------------
diff --git a/hbase-agent/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java b/hbase-agent/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
index db70d2a..774a3cf 100644
--- a/hbase-agent/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
+++ b/hbase-agent/src/main/java/com/xasecure/authorization/hbase/XaSecureAuthorizationCoprocessor.java
@@ -732,15 +732,23 @@ public class XaSecureAuthorizationCoprocessor extends XaSecureAuthorizationCopro
 	private static final String REGIONAL_COPROCESSOR_TYPE = "regional";
 	private static final String REGIONAL_SERVER_COPROCESSOR_TYPE = "regionalServer";
 	@Override
-	public void start(CoprocessorEnvironment env) throws IOException {
+	public void start(CoprocessorEnvironment env) throws IOException {
+		AuditProviderFactory.ApplicationType appType = AuditProviderFactory.ApplicationType.Unknown;
+
 		if (env instanceof MasterCoprocessorEnvironment) {
 			coprocessorType = MASTER_COPROCESSOR_TYPE;
+			appType = AuditProviderFactory.ApplicationType.HBaseMaster;
 		} else if (env instanceof RegionServerCoprocessorEnvironment) {
 			coprocessorType = REGIONAL_SERVER_COPROCESSOR_TYPE;
+			appType = AuditProviderFactory.ApplicationType.HBaseRegionalServer;
 		} else if (env instanceof RegionCoprocessorEnvironment) {
 			regionEnv = (RegionCoprocessorEnvironment) env;
 			coprocessorType = REGIONAL_COPROCESSOR_TYPE;
-		}
+			appType = AuditProviderFactory.ApplicationType.HBaseRegionalServer;
+		}
+
+		XaSecureConfiguration.getInstance().initAudit(appType);
+
 		if (superUserList == null) {
 			superUserList = new ArrayList<String>();
 			Configuration conf = env.getConfiguration();

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/fcf01f98/hdfs-agent/src/main/java/org/apache/hadoop/hdfs/server/namenode/XaSecureFSPermissionChecker.java
----------------------------------------------------------------------
diff --git a/hdfs-agent/src/main/java/org/apache/hadoop/hdfs/server/namenode/XaSecureFSPermissionChecker.java b/hdfs-agent/src/main/java/org/apache/hadoop/hdfs/server/namenode/XaSecureFSPermissionChecker.java
index 28c8226..a5d55c4 100644
--- a/hdfs-agent/src/main/java/org/apache/hadoop/hdfs/server/namenode/XaSecureFSPermissionChecker.java
+++ b/hdfs-agent/src/main/java/org/apache/hadoop/hdfs/server/namenode/XaSecureFSPermissionChecker.java
@@ -104,8 +104,8 @@ public class XaSecureFSPermissionChecker {
 				excludeUsers.add(excludeUser) ;
  			}
 		}
-		
-		
+
+		XaSecureConfiguration.getInstance().initAudit(AuditProviderFactory.ApplicationType.Hdfs);		
 	}
 
 	public static boolean check(UserGroupInformation ugi, INode inode, FsAction access) throws XaSecureAccessControlException {

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/fcf01f98/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizer.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizer.java b/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizer.java
index a7c4611..9acad11 100644
--- a/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizer.java
+++ b/hive-agent/src/main/java/com/xasecure/authorization/hive/authorizer/XaSecureHiveAuthorizer.java
@@ -78,6 +78,24 @@ public class XaSecureHiveAuthorizer extends XaSecureHiveAuthorizerBase {
 		LOG.debug("XaSecureHiveAuthorizer.XaSecureHiveAuthorizer()");
 
 		mHiveAccessVerifier = XaHiveAccessVerifierFactory.getInstance() ;
+		
+		if(!XaSecureConfiguration.getInstance().isAuditInitDone()) {
+			if(sessionContext != null) {
+				AuditProviderFactory.ApplicationType appType = AuditProviderFactory.ApplicationType.Unknown;
+
+				switch(sessionContext.getClientType()) {
+					case HIVECLI:
+						appType = AuditProviderFactory.ApplicationType.HiveCLI;
+					break;
+
+					case HIVESERVER2:
+						appType = AuditProviderFactory.ApplicationType.HiveServer2;
+					break;
+				}
+
+				XaSecureConfiguration.getInstance().initAudit(appType);
+			}
+		}
 	}
 
 

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/fcf01f98/storm-agent/src/main/java/com/xasecure/authorization/storm/authorizer/XaSecureStormAuthorizer.java
----------------------------------------------------------------------
diff --git a/storm-agent/src/main/java/com/xasecure/authorization/storm/authorizer/XaSecureStormAuthorizer.java b/storm-agent/src/main/java/com/xasecure/authorization/storm/authorizer/XaSecureStormAuthorizer.java
index 778f319..b07769c 100644
--- a/storm-agent/src/main/java/com/xasecure/authorization/storm/authorizer/XaSecureStormAuthorizer.java
+++ b/storm-agent/src/main/java/com/xasecure/authorization/storm/authorizer/XaSecureStormAuthorizer.java
@@ -48,7 +48,12 @@ public class XaSecureStormAuthorizer implements IAuthorizer {
 	private static final String repositoryName     = XaSecureConfiguration.getInstance().get(XaSecureHadoopConstants.AUDITLOG_REPOSITORY_NAME_PROP);
 	
 	private XaStormAccessVerifier xaStormVerifier = XaStormAccessVerifierFactory.getInstance() ;
-	
+
+	static {
+		XaSecureConfiguration.getInstance().initAudit(AuditProviderFactory.ApplicationType.Storm);
+	}
+
+
 	/**
      * permit() method is invoked for each incoming Thrift request.
      * @param context request context includes info about 


[3/3] git commit: ARGUS-5: updates per review comments: - default location of audit logs changed to /var/logs/xasecure/audit and hdfs://%hostname%:8020/xasecure/audit - log message improvement - fixed retry interval on flush() failures.

Posted by ma...@apache.org.
ARGUS-5: updates per review comments:
 - default location of audit logs changed to /var/logs/xasecure/audit
and hdfs://%hostname%:8020/xasecure/audit
 - log message improvement
 - fixed retry interval on flush() failures.

Project: http://git-wip-us.apache.org/repos/asf/incubator-argus/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-argus/commit/7a01fbbe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-argus/tree/7a01fbbe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-argus/diff/7a01fbbe

Branch: refs/heads/master
Commit: 7a01fbbe267816320f0f80f6293a4bd2c83d00f6
Parents: 27b7fd7
Author: mneethiraj <mn...@hortonworks.com>
Authored: Thu Sep 25 01:17:12 2014 -0700
Committer: mneethiraj <mn...@hortonworks.com>
Committed: Thu Sep 25 01:17:12 2014 -0700

----------------------------------------------------------------------
 .../audit/provider/LocalFileLogBuffer.java      |  8 +++---
 .../audit/provider/hdfs/HdfsLogDestination.java |  4 +--
 hbase-agent/conf/xasecure-audit.xml             | 28 +++-----------------
 hbase-agent/scripts/install.properties          |  6 ++---
 hdfs-agent/conf/xasecure-audit.xml              | 28 +++-----------------
 hdfs-agent/scripts/install.properties           |  6 ++---
 hive-agent/conf/xasecure-audit.xml              | 28 +++-----------------
 hive-agent/scripts/install.properties           |  6 ++---
 knox-agent/conf/xasecure-audit.xml              | 28 +++-----------------
 knox-agent/scripts/install.properties           |  6 ++---
 storm-agent/conf/xasecure-audit.xml             | 28 +++-----------------
 storm-agent/scripts/install.properties          |  6 ++---
 12 files changed, 41 insertions(+), 141 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7a01fbbe/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java b/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java
index fc53ba6..d59d1db 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java
@@ -278,11 +278,11 @@ public class LocalFileLogBuffer<T> implements LogBuffer<T> {
 			openFile();
 		} else if(now > mNextFlushTime) {
 			try {
-				mWriter.flush();
-
 				mNextFlushTime = now + (mFlushIntervalSeconds * 1000L);
+
+				mWriter.flush();
 			} catch (IOException excp) {
-				LogLog.warn("LocalFileLogBuffer: failed to flush", excp);
+				LogLog.warn("LocalFileLogBuffer: failed to flush to file " + mBufferFilename, excp);
 			}
 		}
 	}
@@ -295,7 +295,7 @@ public class LocalFileLogBuffer<T> implements LogBuffer<T> {
 				try {
 					writer = new OutputStreamWriter(os, mEncoding);
 				} catch(UnsupportedEncodingException excp) {
-					LogLog.warn("LocalFileLogBuffer: failed to create output writer.", excp);
+					LogLog.warn("LocalFileLogBuffer: failed to create output writer for file " + mBufferFilename, excp);
 				}
 			}
 	

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7a01fbbe/agents-audit/src/main/java/com/xasecure/audit/provider/hdfs/HdfsLogDestination.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/hdfs/HdfsLogDestination.java b/agents-audit/src/main/java/com/xasecure/audit/provider/hdfs/HdfsLogDestination.java
index 8872541..60fda6c 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/provider/hdfs/HdfsLogDestination.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/provider/hdfs/HdfsLogDestination.java
@@ -289,9 +289,9 @@ public class HdfsLogDestination<T> implements LogDestination<T> {
 			rollover();
 		} else if(now > mNextFlushTime) {
 			try {
-				mWriter.flush();
-
 				mNextFlushTime = now + (mFlushIntervalSeconds * 1000L);
+
+				mWriter.flush();
 			} catch (IOException excp) {
 				LogLog.warn("HdfsLogDestination: failed to flush", excp);
 			}

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7a01fbbe/hbase-agent/conf/xasecure-audit.xml
----------------------------------------------------------------------
diff --git a/hbase-agent/conf/xasecure-audit.xml b/hbase-agent/conf/xasecure-audit.xml
index c57d580..2bdcc8d 100644
--- a/hbase-agent/conf/xasecure-audit.xml
+++ b/hbase-agent/conf/xasecure-audit.xml
@@ -92,27 +92,7 @@
 	<!-- HDFS audit provider configuration -->
 	<property>
 		<name>xasecure.audit.hdfs.is.enabled</name>
-		<value>false</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.is.async</name>
-		<value>false</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.max.queue.size</name>
-		<value>10240</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.resume.queue.size</name>
-		<value>8192</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.max.flush.interval.ms</name>
-		<value>30000</value>
+		<value>true</value>
 	</property>	
 
 	<property>
@@ -122,7 +102,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.destination.directroy</name>
-		<value>hdfs://namenodehost:8020/audit/hbase/%time:yyyyMMdd%</value>
+		<value>hdfs://%hostname%:8020/xasecure/audit/%app-type%/%time:yyyyMMdd%</value>
 	</property>	
 
 	<property>
@@ -147,7 +127,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.local.buffer.directroy</name>
-		<value>/tmp/logs/hbase</value>
+		<value>/var/log/xasecure/audit/%app-type%</value>
 	</property>	
 
 	<property>
@@ -167,7 +147,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.local.archive.directroy</name>
-		<value>/tmp/logs/archive/hbase</value>
+		<value>/var/log/xasecure/audit/archive/%app-type%</value>
 	</property>	
 
 	<property>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7a01fbbe/hbase-agent/scripts/install.properties
----------------------------------------------------------------------
diff --git a/hbase-agent/scripts/install.properties b/hbase-agent/scripts/install.properties
index 2e227dc..576cda6 100644
--- a/hbase-agent/scripts/install.properties
+++ b/hbase-agent/scripts/install.properties
@@ -112,14 +112,14 @@ XAAUDIT.DB.JDBC_DRIVER=com.mysql.jdbc.Driver
 #  Audit to HDFS
 #
 XAAUDIT.HDFS.IS_ENABLED=false
-XAAUDIT.HDFS.DESTINATION_DIRECTORY=hdfs://localhost:8020/audit/hbase/%time:yyyyMMdd%
+XAAUDIT.HDFS.DESTINATION_DIRECTORY=hdfs://%hostname%:8020/xasecure/audit/%app-type%/%time:yyyyMMdd%
 XAAUDIT.HDFS.DESTINTATION_FILE=%hostname%-audit.log
 XAAUDIT.HDFS.DESTINTATION_FLUSH_INTERVAL_SECONDS=900
 XAAUDIT.HDFS.DESTINTATION_ROLLOVER_INTERVAL_SECONDS=86400
 XAAUDIT.HDFS.DESTINTATION_OPEN_RETRY_INTERVAL_SECONDS=60
-XAAUDIT.HDFS.LOCAL_BUFFER_DIRECTORY=/tmp/logs/hbase
+XAAUDIT.HDFS.LOCAL_BUFFER_DIRECTORY=/var/log/xasecure/audit/%app-type%
 XAAUDIT.HDFS.LOCAL_BUFFER_FILE=%time:yyyyMMdd-HHmm.ss%.log
 XAAUDIT.HDFS.LOCAL_BUFFER_FLUSH_INTERVAL_SECONDS=60
 XAAUDIT.HDFS.LOCAL_BUFFER_ROLLOVER_INTERVAL_SECONDS=600
-XAAUDIT.HDFS.LOCAL_ARCHIVE_DIRECTORY=/tmp/logs/archive/hbase
+XAAUDIT.HDFS.LOCAL_ARCHIVE_DIRECTORY=/var/log/xasecure/audit/archive/%app-type%
 XAAUDIT.HDFS.LOCAL_ARCHIVE_MAX_FILE_COUNT=10

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7a01fbbe/hdfs-agent/conf/xasecure-audit.xml
----------------------------------------------------------------------
diff --git a/hdfs-agent/conf/xasecure-audit.xml b/hdfs-agent/conf/xasecure-audit.xml
index e7c23d4..9e181e0 100644
--- a/hdfs-agent/conf/xasecure-audit.xml
+++ b/hdfs-agent/conf/xasecure-audit.xml
@@ -73,27 +73,7 @@
 	<!-- HDFS audit provider configuration -->
 	<property>
 		<name>xasecure.audit.hdfs.is.enabled</name>
-		<value>false</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.is.async</name>
-		<value>false</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.max.queue.size</name>
-		<value>10240</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.resume.queue.size</name>
-		<value>8192</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.max.flush.interval.ms</name>
-		<value>30000</value>
+		<value>true</value>
 	</property>	
 
 	<property>
@@ -103,7 +83,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.destination.directroy</name>
-		<value>hdfs://namenodehost:8020/audit/hdfs/%time:yyyyMMdd%</value>
+		<value>hdfs://%hostname%:8020/xasecure/audit/%app-type%/%time:yyyyMMdd%</value>
 	</property>	
 
 	<property>
@@ -128,7 +108,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.local.buffer.directroy</name>
-		<value>/tmp/logs/hdfs</value>
+		<value>/var/log/xasecure/audit/%app-type%</value>
 	</property>	
 
 	<property>
@@ -148,7 +128,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.local.archive.directroy</name>
-		<value>/tmp/logs/archive/hdfs</value>
+		<value>/var/log/xasecure/audit/archive/%app-type%</value>
 	</property>	
 
 	<property>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7a01fbbe/hdfs-agent/scripts/install.properties
----------------------------------------------------------------------
diff --git a/hdfs-agent/scripts/install.properties b/hdfs-agent/scripts/install.properties
index d8b6680..4866883 100644
--- a/hdfs-agent/scripts/install.properties
+++ b/hdfs-agent/scripts/install.properties
@@ -105,14 +105,14 @@ XAAUDIT.DB.JDBC_DRIVER=com.mysql.jdbc.Driver
 #  Audit to HDFS
 #
 XAAUDIT.HDFS.IS_ENABLED=false
-XAAUDIT.HDFS.DESTINATION_DIRECTORY=hdfs://localhost:8020/audit/hdfs/%time:yyyyMMdd%
+XAAUDIT.HDFS.DESTINATION_DIRECTORY=hdfs://%hostname%:8020/xasecure/audit/%app-type%/%time:yyyyMMdd%
 XAAUDIT.HDFS.DESTINTATION_FILE=%hostname%-audit.log
 XAAUDIT.HDFS.DESTINTATION_FLUSH_INTERVAL_SECONDS=900
 XAAUDIT.HDFS.DESTINTATION_ROLLOVER_INTERVAL_SECONDS=86400
 XAAUDIT.HDFS.DESTINTATION_OPEN_RETRY_INTERVAL_SECONDS=60
-XAAUDIT.HDFS.LOCAL_BUFFER_DIRECTORY=/tmp/logs/hdfs
+XAAUDIT.HDFS.LOCAL_BUFFER_DIRECTORY=/var/log/xasecure/audit/%app-type%
 XAAUDIT.HDFS.LOCAL_BUFFER_FILE=%time:yyyyMMdd-HHmm.ss%.log
 XAAUDIT.HDFS.LOCAL_BUFFER_FLUSH_INTERVAL_SECONDS=60
 XAAUDIT.HDFS.LOCAL_BUFFER_ROLLOVER_INTERVAL_SECONDS=600
-XAAUDIT.HDFS.LOCAL_ARCHIVE_DIRECTORY=/tmp/logs/archive/hdfs
+XAAUDIT.HDFS.LOCAL_ARCHIVE_DIRECTORY=/var/log/xasecure/audit/archive/%app-type%
 XAAUDIT.HDFS.LOCAL_ARCHIVE_MAX_FILE_COUNT=10

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7a01fbbe/hive-agent/conf/xasecure-audit.xml
----------------------------------------------------------------------
diff --git a/hive-agent/conf/xasecure-audit.xml b/hive-agent/conf/xasecure-audit.xml
index 35c4c8c..37591fc 100644
--- a/hive-agent/conf/xasecure-audit.xml
+++ b/hive-agent/conf/xasecure-audit.xml
@@ -92,27 +92,7 @@
 	<!-- HDFS audit provider configuration -->
 	<property>
 		<name>xasecure.audit.hdfs.is.enabled</name>
-		<value>false</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.is.async</name>
-		<value>false</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.max.queue.size</name>
-		<value>10240</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.resume.queue.size</name>
-		<value>8192</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.max.flush.interval.ms</name>
-		<value>30000</value>
+		<value>true</value>
 	</property>	
 
 	<property>
@@ -122,7 +102,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.destination.directroy</name>
-		<value>hdfs://namenodehost:8020/audit/hive/%time:yyyyMMdd%</value>
+		<value>hdfs://%hostname%:8020/xasecure/audit/%app-type%/%time:yyyyMMdd%</value>
 	</property>	
 
 	<property>
@@ -147,7 +127,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.local.buffer.directroy</name>
-		<value>/tmp/logs/hive</value>
+		<value>/var/log/xasecure/audit/%app-type%</value>
 	</property>	
 
 	<property>
@@ -167,7 +147,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.local.archive.directroy</name>
-		<value>/tmp/logs/archive/hive</value>
+		<value>/var/log/xasecure/audit/archive/%app-type%</value>
 	</property>	
 
 	<property>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7a01fbbe/hive-agent/scripts/install.properties
----------------------------------------------------------------------
diff --git a/hive-agent/scripts/install.properties b/hive-agent/scripts/install.properties
index 1c4a232..11a2c5b 100644
--- a/hive-agent/scripts/install.properties
+++ b/hive-agent/scripts/install.properties
@@ -112,14 +112,14 @@ XAAUDIT.DB.JDBC_DRIVER=com.mysql.jdbc.Driver
 #  Audit to HDFS
 #
 XAAUDIT.HDFS.IS_ENABLED=false
-XAAUDIT.HDFS.DESTINATION_DIRECTORY=hdfs://localhost:8020/audit/hive/%time:yyyyMMdd%
+XAAUDIT.HDFS.DESTINATION_DIRECTORY=hdfs://%hostname%:8020/xasecure/audit/%app-type%/%time:yyyyMMdd%
 XAAUDIT.HDFS.DESTINTATION_FILE=%hostname%-audit.log
 XAAUDIT.HDFS.DESTINTATION_FLUSH_INTERVAL_SECONDS=900
 XAAUDIT.HDFS.DESTINTATION_ROLLOVER_INTERVAL_SECONDS=86400
 XAAUDIT.HDFS.DESTINTATION_OPEN_RETRY_INTERVAL_SECONDS=60
-XAAUDIT.HDFS.LOCAL_BUFFER_DIRECTORY=/tmp/logs/hive
+XAAUDIT.HDFS.LOCAL_BUFFER_DIRECTORY=/var/log/xasecure/audit/%app-type%
 XAAUDIT.HDFS.LOCAL_BUFFER_FILE=%time:yyyyMMdd-HHmm.ss%.log
 XAAUDIT.HDFS.LOCAL_BUFFER_FLUSH_INTERVAL_SECONDS=60
 XAAUDIT.HDFS.LOCAL_BUFFER_ROLLOVER_INTERVAL_SECONDS=600
-XAAUDIT.HDFS.LOCAL_ARCHIVE_DIRECTORY=/tmp/logs/archive/hive
+XAAUDIT.HDFS.LOCAL_ARCHIVE_DIRECTORY=/var/log/xasecure/audit/archive/%app-type%
 XAAUDIT.HDFS.LOCAL_ARCHIVE_MAX_FILE_COUNT=10

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7a01fbbe/knox-agent/conf/xasecure-audit.xml
----------------------------------------------------------------------
diff --git a/knox-agent/conf/xasecure-audit.xml b/knox-agent/conf/xasecure-audit.xml
index c861abb..501b2b7 100644
--- a/knox-agent/conf/xasecure-audit.xml
+++ b/knox-agent/conf/xasecure-audit.xml
@@ -87,27 +87,7 @@
 	<!-- HDFS audit provider configuration -->
 	<property>
 		<name>xasecure.audit.hdfs.is.enabled</name>
-		<value>false</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.is.async</name>
-		<value>false</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.max.queue.size</name>
-		<value>10240</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.resume.queue.size</name>
-		<value>8192</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.max.flush.interval.ms</name>
-		<value>30000</value>
+		<value>true</value>
 	</property>	
 
 	<property>
@@ -117,7 +97,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.destination.directroy</name>
-		<value>hdfs://namenodehost:8020/audit/knox/%time:yyyyMMdd%</value>
+		<value>hdfs://%hostname%:8020/xasecure/audit/%app-type%/%time:yyyyMMdd%</value>
 	</property>	
 
 	<property>
@@ -142,7 +122,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.local.buffer.directroy</name>
-		<value>/tmp/logs/knox</value>
+		<value>/var/log/xasecure/audit/%app-type%</value>
 	</property>	
 
 	<property>
@@ -162,7 +142,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.local.archive.directroy</name>
-		<value>/tmp/logs/archive/knox</value>
+		<value>/var/log/xasecure/audit/archive/%app-type%</value>
 	</property>	
 
 	<property>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7a01fbbe/knox-agent/scripts/install.properties
----------------------------------------------------------------------
diff --git a/knox-agent/scripts/install.properties b/knox-agent/scripts/install.properties
index c93e844..9fa72b0 100644
--- a/knox-agent/scripts/install.properties
+++ b/knox-agent/scripts/install.properties
@@ -98,14 +98,14 @@ XAAUDIT.DB.JDBC_DRIVER=com.mysql.jdbc.Driver
 #  Audit to HDFS
 #
 XAAUDIT.HDFS.IS_ENABLED=false
-XAAUDIT.HDFS.DESTINATION_DIRECTORY=hdfs://localhost:8020/audit/knox/%time:yyyyMMdd%
+XAAUDIT.HDFS.DESTINATION_DIRECTORY=hdfs://%hostname%:8020/xasecure/audit/%app-type%/%time:yyyyMMdd%
 XAAUDIT.HDFS.DESTINTATION_FILE=%hostname%-audit.log
 XAAUDIT.HDFS.DESTINTATION_FLUSH_INTERVAL_SECONDS=900
 XAAUDIT.HDFS.DESTINTATION_ROLLOVER_INTERVAL_SECONDS=86400
 XAAUDIT.HDFS.DESTINTATION_OPEN_RETRY_INTERVAL_SECONDS=60
-XAAUDIT.HDFS.LOCAL_BUFFER_DIRECTORY=/tmp/logs/knox
+XAAUDIT.HDFS.LOCAL_BUFFER_DIRECTORY=/var/log/xasecure/audit/%app-type%
 XAAUDIT.HDFS.LOCAL_BUFFER_FILE=%time:yyyyMMdd-HHmm.ss%.log
 XAAUDIT.HDFS.LOCAL_BUFFER_FLUSH_INTERVAL_SECONDS=60
 XAAUDIT.HDFS.LOCAL_BUFFER_ROLLOVER_INTERVAL_SECONDS=600
-XAAUDIT.HDFS.LOCAL_ARCHIVE_DIRECTORY=/tmp/logs/archive/knox
+XAAUDIT.HDFS.LOCAL_ARCHIVE_DIRECTORY=/var/log/xasecure/audit/archive/%app-type%
 XAAUDIT.HDFS.LOCAL_ARCHIVE_MAX_FILE_COUNT=10

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7a01fbbe/storm-agent/conf/xasecure-audit.xml
----------------------------------------------------------------------
diff --git a/storm-agent/conf/xasecure-audit.xml b/storm-agent/conf/xasecure-audit.xml
index acac19b..37591fc 100644
--- a/storm-agent/conf/xasecure-audit.xml
+++ b/storm-agent/conf/xasecure-audit.xml
@@ -92,27 +92,7 @@
 	<!-- HDFS audit provider configuration -->
 	<property>
 		<name>xasecure.audit.hdfs.is.enabled</name>
-		<value>false</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.is.async</name>
-		<value>false</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.max.queue.size</name>
-		<value>10240</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.resume.queue.size</name>
-		<value>8192</value>
-	</property>	
-
-	<property>
-		<name>xasecure.audit.hdfs.async.max.flush.interval.ms</name>
-		<value>30000</value>
+		<value>true</value>
 	</property>	
 
 	<property>
@@ -122,7 +102,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.destination.directroy</name>
-		<value>hdfs://namenodehost:8020/audit/storm/%time:yyyyMMdd%</value>
+		<value>hdfs://%hostname%:8020/xasecure/audit/%app-type%/%time:yyyyMMdd%</value>
 	</property>	
 
 	<property>
@@ -147,7 +127,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.local.buffer.directroy</name>
-		<value>/tmp/logs/storm</value>
+		<value>/var/log/xasecure/audit/%app-type%</value>
 	</property>	
 
 	<property>
@@ -167,7 +147,7 @@
 
 	<property>
 		<name>xasecure.audit.hdfs.config.local.archive.directroy</name>
-		<value>/tmp/logs/archive/storm</value>
+		<value>/var/log/xasecure/audit/archive/%app-type%</value>
 	</property>	
 
 	<property>

http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/7a01fbbe/storm-agent/scripts/install.properties
----------------------------------------------------------------------
diff --git a/storm-agent/scripts/install.properties b/storm-agent/scripts/install.properties
index 2d28d5d..4403c3c 100644
--- a/storm-agent/scripts/install.properties
+++ b/storm-agent/scripts/install.properties
@@ -102,14 +102,14 @@ XAAUDIT.DB.JDBC_DRIVER=com.mysql.jdbc.Driver
 #  Audit to HDFS
 #
 XAAUDIT.HDFS.IS_ENABLED=false
-XAAUDIT.HDFS.DESTINATION_DIRECTORY=hdfs://localhost:8020/audit/storm/%time:yyyyMMdd%
+XAAUDIT.HDFS.DESTINATION_DIRECTORY=hdfs://%hostname%:8020/xasecure/audit/%app-type%/%time:yyyyMMdd%
 XAAUDIT.HDFS.DESTINTATION_FILE=%hostname%-audit.log
 XAAUDIT.HDFS.DESTINTATION_FLUSH_INTERVAL_SECONDS=900
 XAAUDIT.HDFS.DESTINTATION_ROLLOVER_INTERVAL_SECONDS=86400
 XAAUDIT.HDFS.DESTINTATION_OPEN_RETRY_INTERVAL_SECONDS=60
-XAAUDIT.HDFS.LOCAL_BUFFER_DIRECTORY=/tmp/logs/storm
+XAAUDIT.HDFS.LOCAL_BUFFER_DIRECTORY=/var/log/xasecure/audit/%app-type%
 XAAUDIT.HDFS.LOCAL_BUFFER_FILE=%time:yyyyMMdd-HHmm.ss%.log
 XAAUDIT.HDFS.LOCAL_BUFFER_FLUSH_INTERVAL_SECONDS=60
 XAAUDIT.HDFS.LOCAL_BUFFER_ROLLOVER_INTERVAL_SECONDS=600
-XAAUDIT.HDFS.LOCAL_ARCHIVE_DIRECTORY=/tmp/logs/archive/storm
+XAAUDIT.HDFS.LOCAL_ARCHIVE_DIRECTORY=/var/log/xasecure/audit/archive/%app-type%
 XAAUDIT.HDFS.LOCAL_ARCHIVE_MAX_FILE_COUNT=10


[2/3] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-argus

Posted by ma...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-argus


Project: http://git-wip-us.apache.org/repos/asf/incubator-argus/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-argus/commit/27b7fd70
Tree: http://git-wip-us.apache.org/repos/asf/incubator-argus/tree/27b7fd70
Diff: http://git-wip-us.apache.org/repos/asf/incubator-argus/diff/27b7fd70

Branch: refs/heads/master
Commit: 27b7fd709335e8e4ac68365478dce90f62ef13fe
Parents: fcf01f9 674c615
Author: mneethiraj <mn...@hortonworks.com>
Authored: Thu Sep 25 01:13:44 2014 -0700
Committer: mneethiraj <mn...@hortonworks.com>
Committed: Thu Sep 25 01:13:44 2014 -0700

----------------------------------------------------------------------
 security-admin/pom.xml | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
----------------------------------------------------------------------