Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

[Ambari] Manage retention of hiveserver2.log file by using DailyRollingFileAppender in log4j through Ambari.

avatar
Contributor

Hello,

Does anyone know how to manage retention of hiveserver2.log file by using DailyRollingFileAppender in log4j through Ambari.

E.g. Keep last 30 days' log files which in hiveserver2.log.yyyy-MM-dd format.

BTW, it is DailyRollingFileAppender, not RollingFileAppender.

Thank you.

1 ACCEPTED SOLUTION

avatar
Contributor

I don't think "log4j.appender.DRFA.MaxBackupIndex" is working, even though, it is listed in the log4j-hive.properties file by default and commented in Ambari.

I found out there are two options to achieve the similar goal.

View solution in original post

3 REPLIES 3

avatar

Go to etc/hive/conf

find a file called hive-log4j.prpoerties

# 30-day backup 

#log4j.appender.DRFA.MaxBackupIndex= 30

Find the abouve commented line inside the file.

Remove the # and modify value to 10.

I think this is one you are searching for .

Let me know if it works

avatar
Contributor

Actually, I have done that through Ambari web UI.

However, it didn't work.

Here is what I have done.

Ambari web UI -> Hive -> Configs -> Advanced -> Advanced hive-log4j ->

Hive Log: # of backup files : 7

The "#" is removed from "#log4j.appender.DRFA.MaxBackupIndex={{hive_log_maxbackupindex}}"

After, restarting the hive server, the files placed below are changed.

/etc/hive/conf/hive-log4j.properties

/etc/hive/conf/conf.server/hive-log4j.properties

AFAIK, hiveserver2 uses the seconde file.

Thank you.

avatar
Contributor

I don't think "log4j.appender.DRFA.MaxBackupIndex" is working, even though, it is listed in the log4j-hive.properties file by default and commented in Ambari.

I found out there are two options to achieve the similar goal.