Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Celebrating as our community reaches 100,000 members! Thank you!
Labels (1)
avatar

Often the namenode log files grow in size and they have too many kinds of messages. One of the most commonly faced scenario is where there had been multiple state changes in hdfs and investigating them becomes a pain when there are multiple occurrence in huge log files.

Luckily there is a very easy way to make a few configuration changes to ensure that state change log statements get logged to a separate file.

To isolate and log state change log messages to another file, add the following to hdfs-log4j and restart the namenodes.

You can make this change from Ambari.


Ambari > HDFS service > Configs tab > Advanced tab > Advanced hdfs-log4j section > hdfs-log4j template

# StateChange log 
log4j.logger.org.apache.hadoop.hdfs.StateChange=INFO,SCL 
log4j.additivity.org.apache.hadoop.hdfs.StateChange=false 
log4j.appender.SCL=org.apache.log4j.RollingFileAppender 
log4j.appender.SCL.File=${hadoop.log.dir}/hdfs-state-change.log 
log4j.appender.SCL.MaxFileSize=256MB 
log4j.appender.SCL.MaxBackupIndex=20 
log4j.appender.SCL.layout=org.apache.log4j.PatternLayout 
log4j.appender.SCL.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n 

In this way, HDFS StateChange log messages will be written in ${hadoop.log.dir}/hdfs-state-change.log
1,398 Views