You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/05/28 22:51:45 UTC

[12/32] git commit: ACCUMULO-2840 disable audit logging in mini

ACCUMULO-2840 disable audit logging in mini


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

Branch: refs/heads/ACCUMULO-378
Commit: ff3ad736329584a9eda52948029fb00a8d7346d4
Parents: b2dd64d
Author: Keith Turner <kt...@apache.org>
Authored: Fri May 23 11:47:23 2014 -0400
Committer: Keith Turner <kt...@apache.org>
Committed: Fri May 23 16:27:25 2014 -0400

----------------------------------------------------------------------
 .../impl/MiniAccumuloClusterImpl.java           |  8 ++++
 minicluster/src/main/resources/auditLog.xml     | 41 ++++++++++++++++++++
 2 files changed, 49 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ff3ad736/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
index ef5056c..c82fab3 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
@@ -74,6 +74,7 @@ import org.apache.accumulo.start.Main;
 import org.apache.accumulo.start.classloader.vfs.MiniDFSUtil;
 import org.apache.accumulo.tserver.TabletServer;
 import org.apache.commons.configuration.MapConfiguration;
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.vfs2.FileObject;
 import org.apache.commons.vfs2.impl.VFSClassLoader;
 import org.apache.hadoop.conf.Configuration;
@@ -400,6 +401,13 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
     zooCfg.store(fileWriter, null);
 
     fileWriter.close();
+
+    // disable audit logging for mini....
+    InputStream auditStream = this.getClass().getResourceAsStream("/auditLog.xml");
+
+    if (auditStream != null) {
+      FileUtils.copyInputStreamToFile(auditStream, new File(config.getConfDir(), "auditLog.xml"));
+    }
   }
 
   private void writeConfig(File file, Iterable<Map.Entry<String,String>> settings) throws IOException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/ff3ad736/minicluster/src/main/resources/auditLog.xml
----------------------------------------------------------------------
diff --git a/minicluster/src/main/resources/auditLog.xml b/minicluster/src/main/resources/auditLog.xml
new file mode 100644
index 0000000..9b7987e
--- /dev/null
+++ b/minicluster/src/main/resources/auditLog.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+
+
+    <!--  Write out Audit info to an Audit file -->
+    <appender name="Audit" class="org.apache.log4j.DailyRollingFileAppender">
+        <param name="File"           value="${org.apache.accumulo.core.dir.log}/${org.apache.accumulo.core.ip.localhost.hostname}.audit"/>
+        <param name="MaxBackupIndex" value="10"/>
+        <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS/Z} [%c{2}] %-5p: %m%n"/>
+        </layout>
+    </appender>
+    <logger name="Audit"  additivity="false">
+        <appender-ref ref="Audit" />
+        <level value="OFF"/>
+    </logger>
+
+
+
+
+
+</log4j:configuration>