Community Articles

Find and share helpful community-sourced technical articles.
Labels (1)
avatar
Master Guru

According to default Oozie log4j configuration in Ambari - Log get's rotated by every hour and retention is set to 30 days.

.

log4j.appender.oozie=org.apache.log4j.rolling.RollingFileAppender
log4j.appender.oozie.RollingPolicy=org.apache.oozie.util.OozieRollingPolicy
log4j.appender.oozie.File=${oozie.log.dir}/oozie.log
log4j.appender.oozie.Append=true
log4j.appender.oozie.layout=org.apache.log4j.PatternLayout
log4j.appender.oozie.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - SERVER[${oozie.instance.id}] %m%n
# The FileNamePattern must end with "-%d{yyyy-MM-dd-HH}.gz" or "-%d{yyyy-MM-dd-HH}" and also start with the
# value of log4j.appender.oozie.File
log4j.appender.oozie.RollingPolicy.FileNamePattern=${log4j.appender.oozie.File}-%d{yyyy-MM-dd-HH}
# The MaxHistory controls how many log files will be retained (720 hours / 24 hours per day = 30 days); -1 to disable
log4j.appender.oozie.RollingPolicy.MaxHistory={{oozie_log_maxhistory}}

.

If you want to configure DRFA to roll the log file daily, please set below parameters in log4j section of Oozie configuration via Ambari and restart required services.

log4j.appender.oozie=org.apache.log4j.DailyRollingFileAppender 
log4j.appender.oozie.File=${oozie.log.dir}/oozie.log 
log4j.appender.oozie.Append=true 
log4j.appender.oozie.layout=org.apache.log4j.PatternLayout 
log4j.appender.oozie.layout.ConversionPattern=%d{ISO8601} %5p %c{1}:%L - SERVER[${oozie.instance.id}] %m%n 
log4j.appender.oozie.DatePattern='.'yyyy-MM-dd

.

Please note that DRFA does not support MaxBackupIndex hence if you want retention then you can go with RFA size based rolling and use MaxBackupIndex

.

Please comment if you have any feedback/questions/suggestions. Happy Hadooping!! :)

2,286 Views
Comments
avatar
New Contributor

Hello Kuldeep,

Can you let me know how to set log4j Property based on file size and MaxBackupIndex.

Thanks

Rakesh