<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: how to rotate the HDFS gc logs on data node machines in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232098#M193940</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Please find my working  log4j template content. I just added the following two additional parameters in my DataNode JVm option because i wanted the GC log to get filled up more quickly. &lt;STRONG&gt;-XX:+PrintTenuringDistribution -XX:+PrintAdaptiveSizePolicy&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;      {% else %}
      SHARED_HADOOP_NAMENODE_OPTS="-server -XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC -XX:ErrorFile={{hdfs_log_dir_prefix}}/$USER/hs_err_pid%p.log -XX:NewSize={{namenode_opt_newsize}} -XX:MaxNewSize={{namenode_opt_maxnewsize}} -Xloggc:{{hdfs_log_dir_prefix}}/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -Xms{{namenode_heapsize}} -Xmx{{namenode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT"
      export HADOOP_NAMENODE_OPTS="${SHARED_HADOOP_NAMENODE_OPTS} -XX:OnOutOfMemoryError=\"/usr/hdp/current/hadoop-hdfs-namenode/bin/kill-name-node\" -Dorg.mortbay.jetty.Request.maxFormContentSize=-1 ${HADOOP_NAMENODE_OPTS}"
      export HADOOP_DATANODE_OPTS="-server -XX:ParallelGCThreads=4 -XX:+UseConcMarkSweepGC -XX:ErrorFile=/var/log/hadoop/$USER/hs_err_pid%p.log -XX:NewSize=200m -XX:MaxNewSize=200m -Xloggc:/var/log/hadoop/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xms{{dtnode_heapsize}} -Xmx{{dtnode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT ${HADOOP_DATANODE_OPTS} -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=10K -XX:+PrintTenuringDistribution -XX:+PrintAdaptiveSizePolicy"&lt;/PRE&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/87396-test-log4j.txt"&gt;test-log4j.txt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Notice in my working DataNode opts i have the following settings&lt;/P&gt;&lt;PRE&gt;-XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=10K -XX:+PrintTenuringDistribution -XX:+PrintAdaptiveSizePolicy&lt;/PRE&gt;&lt;P&gt;.&lt;BR /&gt;&lt;A nodeid="26229" rel="user" href="#"&gt;&lt;/A&gt; &lt;/P&gt;</description>
    <pubDate>Mon, 27 Aug 2018 15:40:05 GMT</pubDate>
    <dc:creator>jsensharma</dc:creator>
    <dc:date>2018-08-27T15:40:05Z</dc:date>
    <item>
      <title>how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232082#M193924</link>
      <description>&lt;P&gt;hi all&lt;/P&gt;&lt;P&gt;we are trying to rotate the gc logs on workers machines according to the following&lt;/P&gt;&lt;P&gt;we add the line &lt;/P&gt;&lt;PRE&gt;-XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2K&lt;/PRE&gt;&lt;P&gt;inside HADOOP_DATANODE_OPTS variable&lt;/P&gt;&lt;P&gt;in HDFS --&amp;gt; &lt;STRONG&gt;Advanced hadoop-env&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;as the following:&lt;/P&gt;&lt;PRE&gt;&amp;lt;br&amp;gt;export HADOOP_DATANODE_OPTS="-server -XX:ParallelGCThreads=4 -XX:+UseConcMarkSweepGC -XX:ErrorFile=/var/log/hadoop/$USER/hs_err_pid%p.log -XX:NewSize=200m -XX:MaxNewSize=200m -Xloggc:/var/log/hadoop/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2K -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xms{{dtnode_heapsize}} -Xmx{{dtnode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT ${HADOOP_DATANODE_OPTS}"&lt;/PRE&gt;&lt;P&gt;but we get on worker machine ( data node under /var/log/hadoop/hdfs ) , the follwing&lt;/P&gt;&lt;PRE&gt;-rw-r--r--  1 hdfs hadoop   1035 Aug 26 20:33 hadoop-hdfs-datanode-worker01.sys76.com.log.10
-rw-r--r--  1 hdfs hadoop   1035 Aug 26 20:35 hadoop-hdfs-datanode-worker01.sys76.com.log.9
-rw-r--r--  1 hdfs hadoop   1035 Aug 26 20:36 hadoop-hdfs-datanode-worker01.sys76.com.log.8
-rw-r--r--  1 hdfs hadoop   1504 Aug 26 20:37 hadoop-hdfs-datanode-worker01.sys76.com.log.7
-rw-r--r--  1 hdfs hadoop   1035 Aug 26 20:38 hadoop-hdfs-datanode-worker01.sys76.com.log.6
-rw-r--r--  1 hdfs hadoop   1035 Aug 26 20:40 hadoop-hdfs-datanode-worker01.sys76.com.log.5
-rw-r--r--  1 hdfs hadoop   1035 Aug 26 20:41 hadoop-hdfs-datanode-worker01.sys76.com.log.4
-rw-r--r--  1 hdfs hadoop   1035 Aug 26 20:43 hadoop-hdfs-datanode-worker01.sys76.com.log.3
-rw-r--r--  1 hdfs hadoop   1035 Aug 26 20:44 hadoop-hdfs-datanode-worker01.sys76.com.log.2
-rw-r--r--  1 hdfs hadoop   1035 Aug 26 20:46 hadoop-hdfs-datanode-worker01.sys76.com.log.1
-rw-r--r--  1 hdfs hadoop    727 Aug 26 20:46 hadoop-hdfs-datanode-worker01.sys76.com.out.4
-rw-r--r--  1 hdfs hadoop   3905 Aug 26 20:46 gc.log-201808262031.0.current
-rw-r--r--  1 hdfs hadoop    727 Aug 26 20:46 hadoop-hdfs-datanode-worker01.sys76.com.out.3
-rw-r--r--. 1 hdfs hadoop 101346 Aug 26 21:53 SecurityAuth.audit
-rw-r--r--  1 hdfs hadoop   7488 Aug 27 06:25 gc.log-201808262046
-rw-r--r--  1 hdfs hadoop    727 Aug 27 06:28 hadoop-hdfs-datanode-worker01.sys76.com.out.2
-rw-r--r--  1 hdfs hadoop   3651 Aug 27 06:28 gc.log-201808270625.0.current
-rw-r--r--  1 hdfs hadoop    727 Aug 27 06:29 hadoop-hdfs-datanode-worker01.sys76.com.out.1
-rw-r--r--  1 hdfs hadoop    727 Aug 27 06:29 hadoop-hdfs-datanode-worker01.sys76.com.out
-rw-r--r--  1 hdfs hadoop   2940 Aug 27 06:29 gc.log-201808270629.0.current
-rw-r--r--  1 hdfs hadoop 378069 Aug 27 06:34 hadoop-hdfs-datanode-worker01.sys76.com.log&lt;/PRE&gt;&lt;P&gt;why gc.log.... are not rotated and comes with "0.current" &lt;/P&gt;&lt;P&gt;what is wrong with my configuration?&lt;/P&gt;&lt;P&gt;&lt;EM&gt;** we also try the following but this isn't worked &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;In hadoop-env template wherever you find &lt;STRONG&gt;-XX:+PrintGCDetails &lt;/STRONG&gt;parameter you can add -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;From:&lt;/P&gt;&lt;PRE&gt;HADOOP_JOBTRACKER_OPTS="-server -XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC -XX:ErrorFile={{hdfs_log_dir_prefix}}/$USER/hs_err_pid%p.log -XX:NewSize={{jtnode_opt_newsize}} -XX:MaxNewSize={{jtnode_opt_maxnewsize}} -Xloggc:{{hdfs_log_dir_prefix}}/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xmx{{jtnode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dmapred.audit.logger=INFO,MRAUDIT -Dhadoop.mapreduce.jobsummary.logger=INFO,JSA ${HADOOP_JOBTRACKER_OPTS}"&lt;/PRE&gt;&lt;P&gt;To:&lt;/P&gt;&lt;PRE&gt;HADOOP_JOBTRACKER_OPTS="-server -XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC -XX:ErrorFile={{hdfs_log_dir_prefix}}/$USER/hs_err_pid%p.log -XX:NewSize={{jtnode_opt_newsize}} -XX:MaxNewSize={{jtnode_opt_maxnewsize}} -Xloggc:{{hdfs_log_dir_prefix}}/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails &amp;lt;strong&amp;gt;-XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M &amp;lt;/strong&amp;gt;-XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xmx{{jtnode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dmapred.audit.logger=INFO,MRAUDIT -Dhadoop.mapreduce.jobsummary.logger=INFO,JSA ${HADOOP_JOBTRACKER_OPTS}"&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Aug 2018 13:38:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232082#M193924</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-08-27T13:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232083#M193925</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I see that you are setting the value to 2K as  -XX:GCLogFileSize=&lt;STRONG&gt;2K&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;However as per the JVM option the minimum value for log rotation should be greater than 8KB, Can you please try with 8KB greater value.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;The size of the log file at which point the log will be rotated, must be &amp;gt;= 8K.&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;A href="https://www.oracle.com/technetwork/articles/java/vmoptions-jsp-140102.html" target="_blank"&gt;https://www.oracle.com/technetwork/articles/java/vmoptions-jsp-140102.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 13:46:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232083#M193925</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-08-27T13:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232084#M193926</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Also after setting the value for this parameter to &lt;STRONG&gt;&amp;gt;8K&lt;/STRONG&gt; please make sure that the correct value is being reflected to the JVM options when you run the &lt;STRONG&gt;"ps -ef | grep $PROCESS" &lt;/STRONG&gt;command&lt;BR /&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 13:50:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232084#M193926</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-08-27T13:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232085#M193927</link>
      <description>&lt;P&gt;@Jay&lt;/P&gt;&lt;P&gt;we still get the same results ( we set 10K ) - as gc.log-201808270653.0.current , gc.log-201808270656.0.current&lt;/P&gt;&lt;PRE&gt;-rw-r--r--  1 hdfs hadoop   3859 Aug 27 06:53 gc.log-201808270629.0.current
-rw-r--r--  1 hdfs hadoop    727 Aug 27 06:53 hadoop-hdfs-datanode-worker01.sys76.com.out.1
-rw-r--r--  1 hdfs hadoop   3653 Aug 27 06:56 gc.log-201808270653.0.current
-rw-r--r--  1 hdfs hadoop    727 Aug 27 06:56 hadoop-hdfs-datanode-worker01.sys76.com.out
-rw-r--r--  1 hdfs hadoop 518292 Aug 27 06:56 hadoop-hdfs-datanode-worker01.sys76.com.log
-rw-r--r--  1 hdfs hadoop   3658 Aug 27 06:56 gc.log-201808270656.0.current&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Aug 2018 13:57:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232085#M193927</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-08-27T13:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232086#M193928</link>
      <description>&lt;P&gt;and we verify  10K it reflect from proceess&lt;/P&gt;&lt;PRE&gt; ps -ef | grep 10K
hdfs     109919      1 18 06:56 ?        00:00:25 /usr/jdk64/jdk1.8.0_112/bin/java -Dproc_datanode -Xmx1024m -Dhdp.version=2.6.4.0-91 -Djava.net.preferIPv4Stack=true -Dhdp.version= -Djava.net.preferIPv4Stack=true -Dhdp.version= -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/var/log/hadoop/hdfs -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/usr/hdp/2.6.4.0-91/hadoop -Dhadoop.id.str=hdfs -Dhadoop.root.logger=INFO,console -Djava.library.path=:/usr/hdp/2.6.4.0-91/hadoop/lib/native/Linux-amd64-64:/usr/hdp/2.6.4.0-91/hadoop/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Dhdp.version=2.6.4.0-91 -Dhadoop.log.dir=/var/log/hadoop/hdfs -Dhadoop.log.file=hadoop-hdfs-datanode-worker01.ipmassanalyt183.com.log -Dhadoop.home.dir=/usr/hdp/2.6.4.0-91/hadoop -Dhadoop.id.str=hdfs -Dhadoop.root.logger=INFO,RFA -Djava.library.path=:/usr/hdp/2.6.4.0-91/hadoop/lib/native/Linux-amd64-64:/usr/hdp/2.6.4.0-91/hadoop/lib/native:/usr/hdp/2.6.4.0-91/hadoop/lib/native/Linux-amd64-64:/usr/hdp/2.6.4.0-91/hadoop/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -server -server -XX:ParallelGCThreads=4 -XX:+UseConcMarkSweepGC -XX:ErrorFile=/var/log/hadoop/hdfs/hs_err_pid%p.log -XX:NewSize=200m -XX:MaxNewSize=200m -Xloggc:/var/log/hadoop/hdfs/gc.log-201808270656 -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=10K -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xms1024m -Xmx1024m -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT -server -XX:ParallelGCThreads=4 -XX:+UseConcMarkSweepGC -XX:ErrorFile=/var/log/hadoop/hdfs/hs_err_pid%p.log -XX:NewSize=200m -XX:MaxNewSize=200m -Xloggc:/var/log/hadoop/hdfs/gc.log-201808270656 -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=10K -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xms1024m -Xmx1024m -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT -server -XX:ParallelGCThreads=4 -XX:+UseConcMarkSweepGC -XX:ErrorFile=/var/log/hadoop/hdfs/hs_err_pid%p.log -XX:NewSize=200m -XX:MaxNewSize=200m -Xloggc:/var/log/hadoop/hdfs/gc.log-201808270656 -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=10K -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xms1024m -Xmx1024m -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT -Dhadoop.security.logger=INFO,RFAS org.apache.hadoop.hdfs.server.datanode.DataNode&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Aug 2018 13:59:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232086#M193928</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-08-27T13:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232087#M193929</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;/A&gt; &lt;/P&gt;&lt;P&gt;I see that your GC log file is around  "&lt;STRONG&gt;3658&lt;/STRONG&gt;"  (around 3K) currently so it should get rotated after 10K.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 14:02:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232087#M193929</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-08-27T14:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232088#M193930</link>
      <description>&lt;P&gt;@Jay another quastion can we set the "&lt;/P&gt;&lt;OL&gt;
&lt;LI&gt;-XX:+PrintGCTimeStamps-XX:+UseGCLogFileRotation-XX:NumberOfGCLogFiles=5-XX:GCLogFileSize=10K" , in the end of the line? instead i the middle ?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;example&lt;/P&gt;&lt;PRE&gt;&amp;lt;br&amp;gt;&lt;/PRE&gt;&lt;PRE&gt;HADOOP_DATANODE_OPTS="-server -XX:ParallelGCThreads=4 -XX:+UseConcMarkSweepGC -XX:ErrorFile=/var/log/hadoop/$USER/hs_err_pid%p.log -XX:NewSize=200m -XX:MaxNewSize=200m -Xloggc:/var/log/hadoop/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails  -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xms{{dtnode_heapsize}} -Xmx{{dtnode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT ${HADOOP_DATANODE_OPTS} -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2K"&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Aug 2018 14:10:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232088#M193930</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-08-27T14:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232089#M193931</link>
      <description>&lt;P&gt;I will check  it when it will be more then 10K&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 14:11:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232089#M193931</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-08-27T14:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232090#M193932</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;As per JVM specification if we have duplicate JVM flags set for a process then the parameter which is set at the end will take precedence. Hence it is always better to set our own custom values at the end of the JVM options (instead of middle), Else there are chances that our values might get overridden.&lt;/P&gt;&lt;P&gt;So better to set the JVM parameters after the default parameters.&lt;/P&gt;&lt;P&gt;as following:   hadoop-env templte (inside  {% else %}  block because our JDK might be JDK8)&lt;/P&gt;&lt;PRE&gt;      export HADOOP_DATANODE_OPTS="-server -XX:ParallelGCThreads=4 -XX:+UseConcMarkSweepGC -XX:ErrorFile=/var/log/hadoop/$USER/hs_err_pid%p.log -XX:NewSize=200m -XX:MaxNewSize=200m -Xloggc:/var/log/hadoop/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xms{{dtnode_heapsize}} -Xmx{{dtnode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT ${HADOOP_DATANODE_OPTS} -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=10K -verbose:gc"&lt;BR /&gt; &lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Aug 2018 14:15:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232090#M193932</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-08-27T14:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232091#M193933</link>
      <description>&lt;P&gt;@Jay , I see that you add the "-verbose:gc" &lt;/P&gt;&lt;P&gt;do we need also add this?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 14:51:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232091#M193933</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-08-27T14:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232092#M193934</link>
      <description>&lt;P&gt;@Jay , I see that the log still 4K&lt;/P&gt;&lt;PRE&gt; du -sh * | grep  gc.log-201808270656.0.current&lt;BR /&gt;4.0K    gc.log-201808270656.0.current&lt;/PRE&gt;&lt;P&gt;is it possible to increase this log in order to see if it will rotate ? &lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 14:55:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232092#M193934</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-08-27T14:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232093#M193935</link>
      <description>&lt;P&gt;@Jay&lt;/P&gt;&lt;P&gt;I do the following in order to test it ( we append another  log to &lt;STRONG&gt;gc.log-201808270656.0.current&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;[root@worker01 hdfs]# cat  gc.log-201808262046 &amp;gt;&amp;gt; gc.log-201808270656.0.current
[root@worker01 hdfs]# du -sh * | grep  gc.log-201808270656.0.current
12K     gc.log-201808270656.0.current&lt;/PRE&gt;&lt;P&gt;as you see now the log is 12K , and still not rotated &lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 15:03:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232093#M193935</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-08-27T15:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232094#M193936</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you just want to quickly fill the GC log to see the log rotation then try this instead of  using "cat" comamand to add content inside the actual current GC log file.&lt;/P&gt;&lt;PRE&gt;# su - hdfs
# /usr/jdk64/jdk1.8.0_112/bin/jcmd `cat /var/run/hadoop/hdfs/hadoop-hdfs-datanode.pid` GC.run&lt;BR /&gt;.&lt;BR /&gt;# SYNTAX:
# $JAVA_HOME/bin/jcmd   $DATANODE_PID   GC.run
&lt;/PRE&gt;&lt;P&gt;Use the "jcmd" utility to explicitly trigger the GC many times. So after running this command around 20-30 times you will see that the GC log of data node gets rotated and in the current GC log you will see some messages like:&lt;/P&gt;&lt;PRE&gt;2018-08-27 08:11:07 GC log file has reached the maximum size. Saved as /var/log/hadoop/hdfs/gc.log-201808270803.0&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;I see the log rotations works as expected as following:&lt;/P&gt;&lt;PRE&gt;-rw-r--r--. 1 hdfs hadoop     10617 Aug 27 08:12 gc.log-201808270803.1
-rw-r--r--. 1 hdfs hadoop     10615 Aug 27 08:13 gc.log-201808270803.2
-rw-r--r--. 1 hdfs hadoop     10616 Aug 27 08:13 gc.log-201808270803.3
-rw-r--r--. 1 hdfs hadoop      4001 Aug 27 08:13 gc.log-201808270803.4.current&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 15:09:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232094#M193936</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-08-27T15:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232095#M193937</link>
      <description>&lt;P&gt;@Jay&lt;/P&gt;&lt;P&gt;I do the following&lt;/P&gt;&lt;PRE&gt;[root@worker01 hdfs]# su - hdfs
Last login: Mon Aug 27 08:19:56 UTC 2018 on pts/1
[hdfs@worker01 ~]$  /usr/jdk64/jdk1.8.0_112/bin/jcmd `cat /var/run/hadoop/hdfs/hadoop-hdfs-datanode.pid` GC.run
118714:
Command executed successfully
[hdfs@worker01 ~]$  /usr/jdk64/jdk1.8.0_112/bin/jcmd `cat /var/run/hadoop/hdfs/hadoop-hdfs-datanode.pid` GC.run
118714:
Command executed successfully
[hdfs@worker01 ~]$  /usr/jdk64/jdk1.8.0_112/bin/jcmd `cat /var/run/hadoop/hdfs/hadoop-hdfs-datanode.pid` GC.run
118714:
Command executed successfully
[hdfs@worker01 ~]$  /usr/jdk64/jdk1.8.0_112/bin/jcmd `cat /var/run/hadoop/hdfs/hadoop-hdfs-datanode.pid` GC.run
118714:
Command executed successfully
[hdfs@worker01 ~]$  /usr/jdk64/jdk1.8.0_112/bin/jcmd `cat /var/run/hadoop/hdfs/hadoop-hdfs-datanode.pid` GC.run
118714:
Command executed successfully
[hdfs@worker01 ~]$  /usr/jdk64/jdk1.8.0_112/bin/jcmd `cat /var/run/hadoop/hdfs/hadoop-hdfs-datanode.pid` GC.run
118714:
Command executed successfully
[hdfs@worker01 ~]$  /usr/jdk64/jdk1.8.0_112/bin/jcmd `cat /var/run/hadoop/hdfs/hadoop-hdfs-datanode.pid` GC.run
118714:
Command executed successfully
[hdfs@worker01 ~]$  /usr/jdk64/jdk1.8.0_112/bin/jcmd `cat /var/run/hadoop/hdfs/hadoop-hdfs-datanode.pid` GC.run
118714:
Command executed successfully
[hdfs@worker01 ~]$  /usr/jdk64/jdk1.8.0_112/bin/jcmd `cat /var/run/hadoop/hdfs/hadoop-hdfs-datanode.pid` GC.run
118714:
Command executed successfully&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;but still even if gc log is now 12K , its not rotated &lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 15:22:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232095#M193937</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-08-27T15:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232096#M193938</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You will need to make sure that you have not edited the GC log file manually.   Like you did earlier.  it will cause JVM to loose the logging indexing on the GC log file.     So if by any chance you used the following command then it wont work&lt;/P&gt;&lt;PRE&gt;# cat  gc.log-201808262046 &amp;gt;&amp;gt; gc.log-201808270656.0.current&lt;/PRE&gt;&lt;P&gt;You need a GC log file (Uninterrupted) means you have not touched the file.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Please try restarting this DataNode after deleting the manually edited gc log file. and then keep running the following command for 20-30 times.&lt;/P&gt;&lt;PRE&gt;/usr/jdk64/jdk1.8.0_112/bin/jcmd `cat /var/run/hadoop/hdfs/hadoop-hdfs-datanode.pid` GC.run&lt;/PRE&gt;&lt;P&gt;.&lt;BR /&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 15:25:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232096#M193938</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-08-27T15:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232097#M193939</link>
      <description>&lt;P&gt;@Jay I attached the log4j &lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 15:27:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232097#M193939</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-08-27T15:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232098#M193940</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Please find my working  log4j template content. I just added the following two additional parameters in my DataNode JVm option because i wanted the GC log to get filled up more quickly. &lt;STRONG&gt;-XX:+PrintTenuringDistribution -XX:+PrintAdaptiveSizePolicy&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;      {% else %}
      SHARED_HADOOP_NAMENODE_OPTS="-server -XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC -XX:ErrorFile={{hdfs_log_dir_prefix}}/$USER/hs_err_pid%p.log -XX:NewSize={{namenode_opt_newsize}} -XX:MaxNewSize={{namenode_opt_maxnewsize}} -Xloggc:{{hdfs_log_dir_prefix}}/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -Xms{{namenode_heapsize}} -Xmx{{namenode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT"
      export HADOOP_NAMENODE_OPTS="${SHARED_HADOOP_NAMENODE_OPTS} -XX:OnOutOfMemoryError=\"/usr/hdp/current/hadoop-hdfs-namenode/bin/kill-name-node\" -Dorg.mortbay.jetty.Request.maxFormContentSize=-1 ${HADOOP_NAMENODE_OPTS}"
      export HADOOP_DATANODE_OPTS="-server -XX:ParallelGCThreads=4 -XX:+UseConcMarkSweepGC -XX:ErrorFile=/var/log/hadoop/$USER/hs_err_pid%p.log -XX:NewSize=200m -XX:MaxNewSize=200m -Xloggc:/var/log/hadoop/$USER/gc.log-`date +'%Y%m%d%H%M'` -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xms{{dtnode_heapsize}} -Xmx{{dtnode_heapsize}} -Dhadoop.security.logger=INFO,DRFAS -Dhdfs.audit.logger=INFO,DRFAAUDIT ${HADOOP_DATANODE_OPTS} -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=10K -XX:+PrintTenuringDistribution -XX:+PrintAdaptiveSizePolicy"&lt;/PRE&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/87396-test-log4j.txt"&gt;test-log4j.txt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Notice in my working DataNode opts i have the following settings&lt;/P&gt;&lt;PRE&gt;-XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=10K -XX:+PrintTenuringDistribution -XX:+PrintAdaptiveSizePolicy&lt;/PRE&gt;&lt;P&gt;.&lt;BR /&gt;&lt;A nodeid="26229" rel="user" href="#"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 15:40:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232098#M193940</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-08-27T15:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232099#M193941</link>
      <description>&lt;P&gt;@jay ,&lt;/P&gt;&lt;P&gt;now its working thank to your advice&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;-rw-r--r--  1 hdfs hadoop   10572 Aug 27 09:18 gc.log-201808270913.0
-rw-r--r--  1 hdfs hadoop   10427 Aug 27 09:19 gc.log-201808270913.1
-rw-r--r--  1 hdfs hadoop   10427 Aug 27 09:20 gc.log-201808270913.2
-rw-r--r--. 1 hdfs hadoop  109326 Aug 27 09:20 SecurityAuth.audit
-rw-r--r--  1 hdfs hadoop 1131260 Aug 27 09:20 hadoop-hdfs-datanode-worker01.sys73.com.log
-rw-r--r--  1 hdfs hadoop    9765 Aug 27 09:20 gc.log-201808270913.3.current&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Aug 2018 16:21:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232099#M193941</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-08-27T16:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232100#M193942</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Wonderful !!!!!&lt;BR /&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 16:24:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232100#M193942</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-08-27T16:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to rotate the HDFS gc logs on data node machines</title>
      <link>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232101#M193943</link>
      <description>&lt;P&gt;@Jay , can I do the same for HADOOP_NAMENODE_OPTS variable ? &lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 16:31:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/how-to-rotate-the-HDFS-gc-logs-on-data-node-machines/m-p/232101#M193943</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-08-27T16:31:25Z</dc:date>
    </item>
  </channel>
</rss>

