Community Articles
Find and share helpful community-sourced technical articles
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
Labels (1)

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
494 Views
Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
1 of 1
Last update:
‎09-14-2017 04:04 AM
Updated by:
 
Contributors
Top Kudoed Authors