chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject svn commit: r760759 - in /hadoop/chukwa/trunk: ./ bin/ conf/ src/java/org/apache/hadoop/chukwa/inputtools/log4j/
Date Wed, 01 Apr 2009 01:18:29 GMT
Author: eyang
Date: Wed Apr  1 01:18:28 2009
New Revision: 760759

URL: http://svn.apache.org/viewvc?rev=760759&view=rev
Log:
CHUKWA-65. Redirect metrics log file to CHUKWA_LOG_DIR, and setup read/writable permission
on the metrics
log files.

Modified:
    hadoop/chukwa/trunk/bin/agent.sh
    hadoop/chukwa/trunk/bin/watchdog.sh
    hadoop/chukwa/trunk/build.xml
    hadoop/chukwa/trunk/conf/chukwa-hadoop-metrics-log4j.properties
    hadoop/chukwa/trunk/default.properties
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/log4j/ChukwaDailyRollingFileAppender.java
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/log4j/Log4JMetricsContext.java

Modified: hadoop/chukwa/trunk/bin/agent.sh
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/bin/agent.sh?rev=760759&r1=760758&r2=760759&view=diff
==============================================================================
--- hadoop/chukwa/trunk/bin/agent.sh (original)
+++ hadoop/chukwa/trunk/bin/agent.sh Wed Apr  1 01:18:28 2009
@@ -36,6 +36,11 @@
    stop
 fi
 
+if [ ! -d ${CHUKWA_LOG_DIR} ]; then
+  mkdir -p ${CHUKWA_LOG_DIR}/metrics
+  chmod 777 ${CHUKWA_LOG_DIR}/metrics
+fi
+
 
 ${JAVA_HOME}/bin/java -Xms32M -Xmx64M -DAPP=agent -Dlog4j.configuration=chukwa-log4j.properties
-DCHUKWA_HOME=${CHUKWA_HOME} -DCHUKWA_CONF_DIR=${CHUKWA_CONF_DIR} -DCHUKWA_LOG_DIR=${CHUKWA_LOG_DIR}
-classpath ${CLASSPATH}:${CHUKWA_AGENT}:${CHUKWA_CORE}:${HADOOP_JAR}:${COMMON}:${CHUKWA_CONF_DIR}
org.apache.hadoop.chukwa.datacollection.agent.ChukwaAgent $@ &
 

Modified: hadoop/chukwa/trunk/bin/watchdog.sh
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/bin/watchdog.sh?rev=760759&r1=760758&r2=760759&view=diff
==============================================================================
--- hadoop/chukwa/trunk/bin/watchdog.sh (original)
+++ hadoop/chukwa/trunk/bin/watchdog.sh Wed Apr  1 01:18:28 2009
@@ -145,3 +145,12 @@
       "$bin/chukwa-daemon.sh" --config $CHUKWA_CONF_DIR start dbAdmin.sh &
   fi
 fi
+
+tenmin=`echo ${min} | cut -b 2-`
+if [ "X${tenmin}" == "X0" ]; then
+  if [ -d ${CHUKWA_LOG_DIR}/metrics ]; then
+    ${CHUKWA_HOME}/tools/expire.sh 3 ${CHUKWA_LOG_DIR}/metrics nowait
+  fi
+fi
+
+

Modified: hadoop/chukwa/trunk/build.xml
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/build.xml?rev=760759&r1=760758&r2=760759&view=diff
==============================================================================
--- hadoop/chukwa/trunk/build.xml (original)
+++ hadoop/chukwa/trunk/build.xml Wed Apr  1 01:18:28 2009
@@ -522,6 +522,15 @@
 	</target>
 
 	<target name="chukwa-hadoop_jar" depends="compile" description="Create chukwa_hadoop
jar for use with getting hadoop to use chukwa">
+                <mkdir dir="${build.dir}/conf"/>
+                <copy todir="${build.dir}/conf">
+                    <fileset dir="${basedir}/conf">
+                        <include name="chukwa-hadoop-metrics-log4j.properties"/>
+                    </fileset>
+                    <filterset>
+                        <filter token="CHUKWA_LOG_DIR" value="${CHUKWA_LOG_DIR}"/>
+                    </filterset>
+                </copy>
 
 		<jar jarfile="${build.dir}/chukwa-hadoop-${chukwaVersion}-client.jar" basedir="${build.classes}"
includes="org/apache/hadoop/chukwa/inputtools/log4j/**/*.class">
 			<fileset dir="${basedir}/src/java">
@@ -530,7 +539,7 @@
 		                <include name="org/apache/hadoop/chukwa/datacollection/client/**/*.java"/>
 		                <include name="org/apache/hadoop/chukwa/util/**/*.java"/>
 			</fileset>
-			<fileset dir="${basedir}/conf">
+			<fileset dir="${build.dir}/conf">
 		                <include name="chukwa-hadoop-metrics-log4j.properties"/>
 			</fileset>
 			<fileset dir="${build.classes}">
@@ -894,6 +903,7 @@
 cat %{buildroot}%{_prefix}/tools/service/chukwa-hdfsusage/run | \
 sed 's:/usr/local/chukwa:%{_prefix}:' > %{buildroot}%{_prefix}/tools/service/chukwa-hdfsusage/run.new
 mv %{buildroot}%{_prefix}/tools/service/chukwa-hdfsusage/run.new %{buildroot}%{_prefix}/tools/service/chukwa-hdfsusage/run
+chmod a+x %{buildroot}%{_prefix}/tools/expire.sh
 chmod a+x %{buildroot}/etc/init.d/chukwa-*
 chmod -R a+x %{buildroot}%{_prefix}/tools/service/chukwa-*
 chmod -R a+x %{buildroot}/service/chukwa-*

Modified: hadoop/chukwa/trunk/conf/chukwa-hadoop-metrics-log4j.properties
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/conf/chukwa-hadoop-metrics-log4j.properties?rev=760759&r1=760758&r2=760759&view=diff
==============================================================================
--- hadoop/chukwa/trunk/conf/chukwa-hadoop-metrics-log4j.properties (original)
+++ hadoop/chukwa/trunk/conf/chukwa-hadoop-metrics-log4j.properties Wed Apr  1 01:18:28 2009
@@ -4,7 +4,7 @@
 log4j.appender.chukwa.rpc.DatePattern=.yyyy-MM-dd
 log4j.appender.chukwa.rpc.layout=org.apache.log4j.PatternLayout
 log4j.appender.chukwa.rpc.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
-log4j.appender.chukwa.rpc.Dir=/tmp
+log4j.appender.chukwa.rpc.Dir=@CHUKWA_LOG_DIR@/metrics
 
 log4j.appender.chukwa.jvm.recordType=HadoopMetricsProcessor
 log4j.appender.chukwa.jvm.chukwaClientHostname=localhost
@@ -12,7 +12,7 @@
 log4j.appender.chukwa.jvm.DatePattern=.yyyy-MM-dd
 log4j.appender.chukwa.jvm.layout=org.apache.log4j.PatternLayout
 log4j.appender.chukwa.jvm.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
-log4j.appender.chukwa.jvm.Dir=/tmp
+log4j.appender.chukwa.jvm.Dir=@CHUKWA_LOG_DIR@/metrics
 
 log4j.appender.chukwa.dfs.recordType=HadoopMetricsProcessor
 log4j.appender.chukwa.dfs.chukwaClientHostname=localhost
@@ -20,7 +20,7 @@
 log4j.appender.chukwa.dfs.DatePattern=.yyyy-MM-dd
 log4j.appender.chukwa.dfs.layout=org.apache.log4j.PatternLayout
 log4j.appender.chukwa.dfs.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
-log4j.appender.chukwa.dfs.Dir=/tmp
+log4j.appender.chukwa.dfs.Dir=@CHUKWA_LOG_DIR@/metrics
 
 log4j.appender.chukwa.mapred.recordType=HadoopMetricsProcessor
 log4j.appender.chukwa.mapred.chukwaClientHostname=localhost
@@ -28,4 +28,4 @@
 log4j.appender.chukwa.mapred.DatePattern=.yyyy-MM-dd
 log4j.appender.chukwa.mapred.layout=org.apache.log4j.PatternLayout
 log4j.appender.chukwa.mapred.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
-log4j.appender.chukwa.mapred.Dir=/tmp
\ No newline at end of file
+log4j.appender.chukwa.mapred.Dir=@CHUKWA_LOG_DIR@/metrics

Modified: hadoop/chukwa/trunk/default.properties
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/default.properties?rev=760759&r1=760758&r2=760759&view=diff
==============================================================================
--- hadoop/chukwa/trunk/default.properties (original)
+++ hadoop/chukwa/trunk/default.properties Wed Apr  1 01:18:28 2009
@@ -17,3 +17,4 @@
 hadoop.conf=/usr/local/hadoop
 rpm.uid=chukwa
 rpm.gid=users
+CHUKWA_LOG_DIR=/usr/local/chukwa/var/log

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/log4j/ChukwaDailyRollingFileAppender.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/log4j/ChukwaDailyRollingFileAppender.java?rev=760759&r1=760758&r2=760759&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/log4j/ChukwaDailyRollingFileAppender.java
(original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/log4j/ChukwaDailyRollingFileAppender.java
Wed Apr  1 01:18:28 2009
@@ -553,7 +553,7 @@
 
             // FIXME: Hack to make the log file readable by chukwa user. 
             if(System.getProperty("os.name").intern()=="Linux".intern()) {
-              Runtime.getRuntime().exec("chmod 640 "+getFile());
+              Runtime.getRuntime().exec("chmod g+rw "+getFile());
             }
             
             // Watchdog is watching for ChukwaAgent only once every 5 minutes,

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/log4j/Log4JMetricsContext.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/log4j/Log4JMetricsContext.java?rev=760759&r1=760758&r2=760759&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/log4j/Log4JMetricsContext.java
(original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/inputtools/log4j/Log4JMetricsContext.java
Wed Apr  1 01:18:28 2009
@@ -76,6 +76,7 @@
     if (out == null) {
       synchronized (lock) {
         if (out == null) {
+          String logName = null;
           java.util.Properties properties = new java.util.Properties();
           properties.load(this.getClass().getClassLoader().getResourceAsStream(
               "chukwa-hadoop-metrics-log4j.properties"));
@@ -90,7 +91,7 @@
           appender.setAppend(true);
           if (properties.getProperty("log4j.appender.chukwa." + contextName
               + ".Dir") != null) {
-            String logName = properties.getProperty("log4j.appender.chukwa."
+            logName = properties.getProperty("log4j.appender.chukwa."
                 + contextName + ".Dir")
                 + File.separator
                 + "chukwa-"
@@ -100,16 +101,11 @@
                 + "-"
                 + System.currentTimeMillis() + ".log";
 
-            // FIXME: Hack to make the log file readable by chukwa user.
-            if (System.getProperty("os.name").intern() == "Linux".intern()) {
-              Runtime.getRuntime().exec("chmod 640 " + logName);
-            }
             appender.setFile(logName);
           } else {
-            appender
-                .setFile(metricsLogDir + File.separator + "chukwa-" + user
-                    + "-" + contextName + "-" + System.currentTimeMillis()
-                    + ".log");
+            logName = metricsLogDir+File.separator+"chukwa-"+user+"-"
+                +contextName + "-" + System.currentTimeMillis()+ ".log";
+            appender.setFile(logName);
           }
           appender.activateOptions();
           appender.setRecordType(properties
@@ -126,6 +122,10 @@
                   + ".DatePattern"));
           logger.addAppender(appender);
           out = logger;
+          // FIXME: Hack to make the log file readable by chukwa user.
+          if (System.getProperty("os.name").intern() == "Linux".intern()) {
+            Runtime.getRuntime().exec("chmod 666 " + logName);
+          }
         }
       }
     }



Mime
View raw message