Upgrading Log Rotation Configuration
Ambari 2.6.x 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.0, 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.DailyRollingFileAppender
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.DailyRollingFileAppender
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.
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.DailyRollingFileAppender
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.DailyRollingFileAppender
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.DailyRollingFileAppender
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.DailyRollingFileAppender
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.DailyRollingFileAppender
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.
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.