Created 02-23-2021 04:32 AM
Hi community,
I have found an issue on CDH 6 with hive log rotation. In this CDH version, hive log4j changes from rotation by size (configured by cloudera manager) to rotation by size and day (RFA to DRFA).
ISSUE
This change results in:
I'm completely sure that is a new issue, because hive log4j configuration changes on this version.
SOLUTION
The solution for me was changing the "appender.DRFA.rollingPolicy.FileNamePattern" property through Cloudera Safety Valve in Hive Server 2, "Logging Advanced Configuration Snippet". Adding this new line:
appender.DRFA.rollingPolicy.FileNamePattern=${hive.log.dir}/${hive.log.file}.%i
After restarting Hiver Server 2, the log rotation behaviour changes, with this change, I only have extrictly "Maximum Log File Backups" files with "Max Log Size" size, keeping away that the FS can be filled.
DEBUGGING
This actions are only for debugging proposal
I recommend you to check if you are using this CDH version (in my case 6.0.1) and if you have this issue too, you can validate this behaviour generating more logs changing "Debug Level" to TRACE and reducing "Max Log Size Maximum" to 1MB and "Log File Backups" to 2 and run any query on hive.
If your new logs are not rotated properly (hive only keep 2 new logs), more probably you have the same issue.
On latest versions, Cloudera adds new properties on hive log4j, probably to avoid this issue, but it keeps rotation by day, so we can experiment the issue (point 2) too. I think that rotation by day pattern is not the best option, by index is more effective, even by day and hour (hour, minute and second).
Marc Casajus
Created 03-23-2021 06:47 AM
Update: this issue is fixed in CM7.2.1
Ferenc Erdelyi, Technical Solutions Manager
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:
Created on 02-25-2021 09:42 AM - last edited on 02-26-2021 12:51 AM by VidyaSargur
Hello @marccasajus
Yes, this has been documented internally as a BUG (OPSAPS-53043) and is currently not fixed.
Also, it looks you have already applied the changes which would address this.
Created 03-23-2021 06:47 AM
Update: this issue is fixed in CM7.2.1
Ferenc Erdelyi, Technical Solutions Manager
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:
Created on 10-16-2022 09:02 PM - edited 10-16-2022 09:10 PM
seems not working in CDH 6.2, this solution will cause hive2 restart failed. with <No type attribute provided for component rollingPolicy>
hive log4j config in cdh6.2
---------------------------
property.max.log.file.size=200MB
property.max.log.file.backup.index=10
appender.DRFA.type=RollingRandomAccessFile
appender.DRFA.name=DRFA
appender.DRFA.fileName=${log.dir}/${log.file}
appender.DRFA.filePattern=${log.dir}/${log.file}.%d{yyyy-MM-dd}
appender.DRFA.layout.typetternLayout
appender.DRFA.layout.pattern=%d{DEFAULT} %-5p %c: [%t]: %m%n
appender.DRFA.policies.type=Policies
appender.DRFA.policies.size.type=SizeBasedTriggeringPolicy
appender.DRFA.policies.size.size=${max.log.file.size}
appender.DRFA.strategy.type=DefaultRolloverStrategy
appender.DRFA.strategy.max=${max.log.file.backup.index}
Created 10-17-2022 01:07 AM
it should be like this, appender.DRFA.filePattern=${log.dir}/${log.file}.%d{yyyy-MM-dd}.%i
and it will be working in CDH 6.2
Created 11-24-2022 10:01 PM