Created on 08-08-2017 01:51 AM - edited 09-16-2022 05:03 AM
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.
Created 08-10-2017 03:41 AM
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.
Created 08-08-2017 04:54 AM
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
Created 08-08-2017 05:18 AM
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.
Created 08-10-2017 03:41 AM
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.