Upgrading Log Rotation Configuration
Ambari 2.6.0 provides s a simplified log rotation configuration. These changes will be made automatically during your next stack upgrade, but are not automatically made during the Ambari upgrade. After upgrading Ambari from version 2.x to 2.6.1, if you want to utilize the simplified log rotation configuration, you must update configurations for all services in your cluster, using the following steps:
Steps
ZooKeeper
In Ambari Web, browse to ZooKeeper > Configs.
Scroll down to Custom zookeeper-log4j.
In Custom zookeeper-log4j, click Add Property.
In Add Property, type the following properties and values:
zookeeper_log_max_backup_size=10
zookeeper_log_number_of_backup_files=10
For example:
Click Add.
Browse to Advanced zookeeper-log4j.
In Advanced zookeeper-log4j content section, find and replace the following properties and values:
Find: log4j.appender.ROLLINGFILE.MaxFileSize=<value>
Replace: log4j.appender.ROLLINGFILE.MaxFileSize={{zookeeper_log_number_of_backup_files}}MB
Find: #log4j.appender.ROLLINGFILE.MaxBackupIndex=<value>MB
Replace: #log4j.appender.ROLLINGFILE.MaxBackupIndex={{zookeeper_log_number_of_backup_files}}
For example:
In Configs, click Save.
For example:
Restart ZooKeeper, as prompted.
Kafka
In Ambari Web, browse to Kafka > Configs.
Scroll down to Custom Kafka-log4j.
In Custom Kafka-log4j, click Add Property.
In Add Property, type the following properties and values:
kafka_log_maxfilesize=256
kafka_log_maxbackupindex=20
controller_log_maxfilesize=256
controller_log_maxbackupindex=20
Click Add.
Browse to Advanced kafka-log4j.
In Advanced kafka-log4j content section, find and replace the following properties and values:
Find: log4j.appender.kafkaAppender=org.apache.log4j.RollingFileAppender
Add: log4j.appender.kafkaAppender.MaxFileSize = {{kafka_log_maxfilesize}}MB
Add: log4j.appender.kafkaAppender.MaxBackupIndex = {{kafka_log_maxbackupindex}}MB
Find: log4j.appender.controllerAppender=org.apache.log4j.RollingFileAppender
Add: log4j.appender.controllerAppender.MaxFileSize = {{controller_log_maxfilesize}}MB
Add: log4j.appender.controllerAppender.MaxBackupIndex = {{controller_log_maxbackupindex}}
In Configs, click Save.
Restart Kafka, as prompted.
Knox
In Ambari Web, browse to Knox > Configs.
Scroll down to Custom gateway-log4j.
In Custom gateway-log4j, click Add Property.
In Add Property, type the following properties and values:
knox_gateway_log_maxfilesize=256
knox_gateway_log_maxbackupindex=20
Click Add.
Browse to Advanced gateway-log4j.
In Advanced gateway-log4j content section, find and replace the following properties and values:
Find: log4j.appender.drfa=org.apache.log4j.RollingFileAppender
Add: log4j.appender.drfa.MaxFileSize = {{knox_gateway_log_maxfilesize}}MB
Add: log4j.appender.drfa.MaxBackupIndex = {{knox_gateway_log_maxbackupindex}}
In Configs, click Save.
Restart Knox.
Atlas
In Ambari Web, browse to Atlas > Configs > Advanced.
Scroll down to Custom Atlas-log4j.
In Custom Atlas-log4j, click Add Property.
In Add Property, type the following properties and values:
atlas_log_max_backup_size=256
atlas_log_number_of_backup_files=20
Click Add.
Browse to Advanced atlas-log4j.
In Advanced atlas-log4j content section, find and replace the following properties and values:
Find: <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
Add: <param name="MaxFileSize" value="{{atlas_log_max_backup_size}}MB" >
Add: <param name="MaxBackupIndex" value="{{atlas_log_number_of_backup_files}}" >
In Configs, click Save.
Restart Atlas, as prompted.
Ranger
In Ambari Web, browse to Ranger > Configs > Advanced.
Scroll down to Custom admin-log4j.
In Custom admin-log4j, click Add Property.
In Add Property, type the following properties and values:
ranger_xa_log_maxfilesize=256
ranger_xa_log_maxbackupindex=20
Click Add.
Browse to Advanced admin-log4j.
In Advanced admin-log4j content section, find and replace the following properties and values:
Find: log4j.appender.xa_log_appender=org.apache.log4j.RollingFileAppender
Add: log4j.appender.xa_log_appender.MaxFileSize={{ranger_xa_log_maxfilesize}}MB
Add: log4j.appender.xa_log_appender.MaxBackupIndex={{ranger_xa_log_maxbackupindex}}
Scroll down to Custom usersync-log4j.
In Custom usersync-log4j, click Add Property.
In Add Property, type the following properties and values:
ranger_usersync_log_maxfilesize=256
ranger_usersync_log_number_of_backup_files=20
Click Add.
Browse to Advanced usersync-log4j.
In Advanced usersync-log4j content section, find and replace the following properties and values:
Find: log4j.appender.logFile=org.apache.log4j.RollingFileAppender
Add: log4j.appender.logFile.MaxFileSize = {{ranger_usersync_log_maxfilesize}}MB
Add: log4j.appender.logFile.MaxBackupIndex = {{ranger_usersync_log_number_of_backup_files}}
Scroll down to Custom tagsync-log4j.
In Custom tagsync-log4j, click Add Property.
In Add Property, type the following properties and values:
ranger_tagsync_log_maxfilesize=256
ranger_tagsync_log_number_of_backup_files=20
Click Add.
Browse to Advanced tagsync-log4j.
In Advanced tagsync-log4j content section, find and replace the following properties and values:
Find: log4j.appender.logFile=org.apache.log4j.RollingFileAppender
Add: log4j.appender.logFile.MaxFileSize = {{ranger_tagsync_log_maxfilesize}}MB
Add: log4j.appender.logFile.MaxBackupIndex = {{ranger_tagsync_log_number_of_backup_files}}
In Configs, click Save.
Restart Ranger, as prompted.
Ranger-KMS
In Ambari Web, browse to Ranger-KMS > Configs > Advanced.
Scroll down to Custom kms-log4j.
In Custom kms-log4j, click Add Property.
In Add Property, type the following properties and values:
ranger_kms_log_maxfilesize=256
ranger_kms_log_maxbackupindex=20
ranger_kms_audit_log_maxfilesize=256
ranger_kms_audit_log_maxbackupindex=20
Click Add.
Browse to Advanced kms-log4j .
In Advanced kms-log4j content section, find and replace the following properties and values:
Find: log4j.appender.kms=org.apache.log4j.RollingFileAppender
Add: log4j.appender.kms.MaxFileSize = {{ranger_kms_log_maxfilesize}}MB
Add: log4j.appender.kms.MaxBackupIndex = {{ranger_kms_log_maxbackupindex}}
Find: log4j.appender.kms-audit=org.apache.log4j.RollingFileAppender
Add: log4j.appender.kms-audit.MaxFileSize={{ranger_kms_audit_log_maxfilesize}}MB
Add: log4j.appender.kms-audit.MaxBackupIndex = {{ranger_kms_audit_log_maxbackupindex}}
In Configs, click Save.
Restart Ranger-KMS.
HBase
In Ambari Web, browse to HBase > Configs > Advanced.
Scroll down to Custom hbase-log4j.
In Custom hbase-log4j, click Add Property.
In Add Property, type the following properties and values:
hbase_log_maxfilesize=256
hbase_log_maxbackupindex=20
hbase_security_log_maxfilesize=256
hbase_security_log_maxbackupindex=20
Click Add.
Browse to Advanced hbase-log4j .
In Advanced hbase-log4j content section, find and replace the following properties and values:
Find: hbase.log.maxfilesize=<value>MB
Replace: hbase.log.maxfilesize={{hbase_log_maxfilesize}}MB
Find: hbase.log.maxbackupindex=<value>
Replace: hbase.log.maxbackupindex={{hbase_log_maxbackupindex}}
Find: hbase.security.log.maxfilesize=<value>MB
Replace: hbase.security.log.maxfilesize={{hbase_security_log_maxfilesize}}MB
Find: hbase.security.log.maxbackupindex=<value>
Replace: hbase.security.log.maxbackupindex={{hbase_security_log_maxbackupindex}}
In Configs, click Save.
Restart HBase.
Hive
In Ambari Web, browse to Hive > Configs > Advanced.
Scroll down to Custom hive-log4j.
In Custom hive-log4j, click Add Property.
In Add Property, type the following properties and values:
hive_log_maxfilesize=256
hive_log_maxbackupindex=30
Click Add.
Browse to Advanced hive-log4j .
In Advanced hive-log4j content section, find and replace the following properties and values:
Find: #log4j.appender.DRFA.MaxBackupIndex=<value>
Replace: #log4j.appender.DRFA.MaxBackupIndex= {{hive_log_maxbackupindex}}
Find: log4j.appender.DRFA.MaxBackupIndex=<value>
Add: log4j.appender.DRFA.MaxFileSize = {{hive_log_maxfilesize}}MB
Scroll down to Custom llap-daemon-log4j.
In Custom llap-daemon-log4j, click Add Property.
In Add Property, type the following properties and values:
hive_llap_log_maxfilesize=256
hive_log_maxbackupindex=240
Click Add.
Browse to llap-daemon-log4j.
In llap-daemon-log4j content section, find and replace the following properties and values:
Find: property.llap.daemon.log.maxfilesize =<value>MB
Replace: property.llap.daemon.log.maxfilesize = {{hive_llap_log_maxfilesize}}MB
Find: property.llap.daemon.log.maxbackupindex=<value>
Replace: property.llap.daemon.log.maxbackupindex={{hive_llap_log_maxbackupindex}}
Scroll down to Custom webhcat-log4j.
In Custom webhcat-log4j, click Add Property.
In Add Property, type the following properties and values:
webhcat_log_maxfilesize=256
webhcat_log_maxbackupindex=240
Click Add.
Browse to webhcat-log4j .
In webhcat-log4j content section, find and replace the following properties and values:
Find: log4j.appender.standard = org.apache.log4j.RollingFileAppender
Add: log4j.appender.standard.MaxFileSize = {{webhcat_log_maxfilesize}}MB
Add: log4j.appender.standard.MaxBackupIndex = {{webhcat_log_maxbackupindex}}
In Configs, click Save.
Restart Hive, as prompted.
Storm
In Ambari Web, browse to Storm > Configs.
Scroll down to Custom cluster-log4j property.
In Custom cluster-log4j property, click Add Property.
In Add Property, type the following properties and values:
storm_a1_maxfilesize=100
storm_a1_maxbackupindex=9
Click Add.
Browse to Advanced storm-cluster-log4j .
In Advanced storm-cluster-log4j content section, find and replace the following properties and values:
Find: In RollingFile="A1"<SizeBasedTriggeringPolicy size=”<value>MB"/>
Replace: <SizeBasedTriggeringPolicy size="{{storm_a1_maxfilesize}}MB"/>
Find: In RollingFile="A1"<DefaultRolloverStrategy max="<value>"/>
Replace: <DefaultRolloverStrategy max="{{storm_a1_maxbackupindex}}"/>
Scroll down to Custom worker-log4j property.
In Custom worker-log4j property, click Add Property.
In Add Property, type the following properties and values:
storm_wrkr_a1_maxfilesize=100
storm_wrkr_a1_maxbackupindex=9
storm_wrkr_out_maxfilesize=100
storm_wrkr_out_maxbackupindex=4
storm_wrkr_err_maxfilesize=100
storm_wrkr_err_maxbackupindex=4
Click Add.
Browse to Advanced storm-worker-log4j .
In Advanced storm-worker-log4j content section, find and replace the following properties and values:
Find: In RollingFile="A1"<SizeBasedTriggeringPolicy size="<value> MB"/>
Replace: <SizeBasedTriggeringPolicy size="{{storm_wrkr_a1_maxfilesize}} MB"/>
Find: In RollingFile="A1"<DefaultRolloverStrategy max="<value>"/>
Replace: <DefaultRolloverStrategy max="{{storm_wrkr_a1_maxbackupindex}}"/>
Find: In RollingFile="STDOUT"<SizeBasedTriggeringPolicy size="<value>" MB/>
Replace: <SizeBasedTriggeringPolicy size="{{storm_wrkr_out_maxfilesize}} MB"/>
Find: In RollingFile="STDOUT"<DefaultRolloverStrategy max="<value>"/>
Replace: <DefaultRolloverStrategy max="{{storm_wrkr_out_maxbackupindex}}"/>
Find: In RollingFile=”STDERR”<SizeBasedTriggeringPolicy size=”<value>” MB/>
Replace: <SizeBasedTriggeringPolicy size="{{storm_wrkr_err_maxfilesize}} MB"/>
Find: In RollingFile="STDOUT"<DefaultRolloverStrategy max="<value>"/>
Replace: <DefaultRolloverStrategy max="{{storm_wrkr_err_maxbackupindex}}"/>
In Configs, click Save.
Restart Storm, as prompted.
Falcon
In Ambari Web, browse to Falcon > Configs.
Scroll down to Custom falcon-log4j.
In Custom falcon-log4j, click Add Property.
In Add Property, type the following properties and values:
falcon_log_maxfilesize=256
falcon_log_maxbackupindex=20
falcon_security_log_maxfilesize=256
falcon_security_log_maxbackupindex=20
Click Add.
Browse to Advanced falcon-log4j .
In Advanced falcon-log4j content section, find and replace the following properties and values:
Find: <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
Add: <param name="MaxFileSize" value="{{falcon_log_maxfilesize}}MB" />
Add: <param name="MaxBackupIndex" value="{{falcon_log_maxbackupindex}}" />
Find: <appendername="SECURITY"class="org.apache.log4j.RollingFileAppender">
Add: <param name="MaxFileSize" value="{{falcon_security_log_maxfilesize}}MB"/>
Add: <param name="MaxBackupIndex" value="{{falcon_security_log_maxbackupindex}}"/>
In Configs, click Save.
Restart Falcon.
Oozie
In Ambari Web, browse to Oozie > Configs.
Scroll down to Custom oozie-log4j.
In Custom oozie-log4j, click Add Property.
In Add Property, type the following properties and values:
oozie_log_maxhistory=720
Click Add.
Browse to Advanced oozie-log4j .
In Advanced oozie-log4j content section, find and replace the following properties and values:
Find: log4j.appender.oozie.RollingPolicy.MaxHistory=720
Replace: log4j.appender.oozie.RollingPolicy.MaxHistory={{oozie_log_maxhistory}}
In Configs, click Save.
Restart Oozie, as prompted.
HDFS
In Ambari Web, browse to HDFS > Configs > Advanced.
Scroll down to Custom HDFS-log4j.
In Custom HDFS-log4j, click Add Property.
In Add Property, type the following properties and values:
hadoop_security_log_max_backup_size = 256
hadoop_security_log_number_of_backup_files = 20
hadoop_log_max_backup_size = 256
hadoop_log_number_of_backup_files = 10
Click Add.
Browse to Advanced hdfs-log4j .
In Advanced hdfs-log4j content section, find and replace the following properties and values:
Find: hadoop.security.log.maxfilesize= <value>MB
Replace: hadoop.security.log.maxfilesize={{hadoop_security_log_max_backup_size}}MB
Find: hadoop.security.log.maxbackupindex=20
Replace: hadoop.security.log.maxbackupindex={{hadoop_security_log_number_of_backup_files}}
Find: log4j.appender.RFA.MaxFileSize=<value>MB
Replace: log4j.appender.RFA.MaxFileSize={{hadoop_log_max_backup_size}}MB
Find: log4j.appender.RFA.MaxBackupIndex=<value>
Replace: log4j.appender.RFA.MaxBackupIndex={{hadoop_log_number_of_backup_files}}
In Configs, click Save.
Restart HDFS, as prompted.
YARN
In Ambari Web, browse to YARN > Configs > Advanced.
Scroll down to Custom YARN-log4j property.
In Custom YARN-log4j property, click Add Property.
In Add Property, type the following properties and values:
yarn_rm_summary_log_max_backup_size=256
yarn_rm_summary_log_number_of_backup_files=20
Click Add.
Browse to Advanced yarn-log4j .
In Advanced yarn-log4j content section, find and replace the following properties and values:
Find: log4j.appender.RMSUMMARY.MaxFileSize=<value>MB
Replace: log4j.appender.RMSUMMARY.MaxFileSize={{yarn_rm_summary_log_max_backup_size}}MB
Find: log4j.appender.RMSUMMARY.MaxBackupIndex=<value>
Replace: log4j.appender.RMSUMMARY.MaxBackupIndex={{yarn_rm_summary_log_number_of_backup_files}}
In Configs, click Save.
Restart YARN, as prompted.