HDFS audit configuration best practices
This topic provides guidance on optimizing Apache Ranger HDFS audit logging performance and durability, including directory organization, rollover intervals, file format selection, HDFS replication, and monitoring log signatures.
- Directory organization
-
# Recommended: Separate by app type and date xasecure.audit.destination.hdfs.subdir=%app-type%/%time:yyyyMMdd% # For analytics: Use Hive partition format xasecure.audit.destination.hdfs.subdir=%app-type%/year=%time:yyyy%/month=%time:MM%/day=%time:dd% - Rollover frequency
-
-
High volume (>1000 events/sec): Hourly (1h)
-
Medium volume (100-1000 events/sec): 6-12 hours (6h or 12h)
-
Low volume (<100 events/sec): Daily (1d)
-
- File format selection
-
-
JSON: Development, debugging, small scale
-
ORC: Production, analytics, large scale
-
- Periodic rollover
-
Always enable for production:
xasecure.audit.destination.hdfs.file.rollover.enable.periodic.rollover=true xasecure.audit.destination.hdfs.file.rollover.periodic.rollover.check.sec=60 - Replication and durability
-
# Higher replication for critical audits xasecure.audit.destination.hdfs.config.dfs.replication=3 # Larger blocks for better performance xasecure.audit.destination.hdfs.config.dfs.blocksize=134217728 - Monitoring
- Monitor these log messages:
-
"Creating new log file. auditPath = ..."- New file created -
"Closing file. Rolling over. name = ..."- File rolled over -
"Stream encountered errors!"- Write failure -
"Failed to append to file"- Append failure
-
