HDFS audit configuration troubleshooting
This topic provides troubleshooting steps for resolving Apache Ranger HDFS audit destination errors, including rollover issues, file write conflicts, connectivity failures, and cloud storage authentication errors.
- Issue: Files not rolling over
-
-
Symptoms: Single file grows very large
-
Causes:
-
Rollover period/duration not set
-
Periodic rollover disabled in low-traffic environment
-
Rollover period misconfigured
-
- Solutions:
# Enable periodic rollover xasecure.audit.destination.hdfs.file.rollover.enable.periodic.rollover=true xasecure.audit.destination.hdfs.file.rollover.periodic.rollover.check.sec=60 # Set appropriate rollover xasecure.audit.destination.hdfs.file.rollover.period=1d
-
- Issue: Multiple small files created
-
-
Symptoms: Many files with numeric suffixes (.1, .2, .3)
-
Causes:
-
Multiple plugin instances writing simultaneously
-
Frequent service restarts
-
Clock skew between nodes
-
- Solutions:
# Enable append mode xasecure.audit.destination.hdfs.file.append.enabled=true # Include hostname in filename xasecure.audit.destination.hdfs.filename.format=%app-type%_audit_%hostname%.log # For multiple instances on same host, include timestamp xasecure.audit.destination.hdfs.filename.format=%app-type%_audit_%hostname%_%time:yyyyMMddHHmmss%.log
-
- Issue: Append not working
-
-
Symptoms: New files created on restart despite append enabled
-
Causes:
-
File system doesn't support append (S3, Azure Blob)
-
HDFS version too old
-
Append capability check failing
-
- Check
Logs:
"Failed to append to file <path> due to <error>" "Falling back to create a new log file!" - Solutions:
-
Verify file system supports append
-
Use
file.append.enabled=falsefor S3/Azure Blob -
Upgrade HDFS if using old version
-
-
- Issue: Cannot connect to HDFS
-
-
Symptoms:
FileSystem.get()fails -
Causes:
-
Incorrect HDFS URI
-
NameNode unreachable
-
Kerberos authentication failure
-
HA configuration incorrect
-
- Solutions:
# Check URI format xasecure.audit.destination.hdfs.dir=hdfs://namenode.company.com:8020/ranger/audit # For HA, use nameservice xasecure.audit.destination.hdfs.dir=hdfs://mycluster/ranger/audit # Add connection timeout and retries xasecure.audit.destination.hdfs.config.ipc.client.connect.timeout=20000 xasecure.audit.destination.hdfs.config.ipc.client.connect.max.retries=10 # Verify Kerberos xasecure.audit.destination.hdfs.config.hadoop.security.authentication=kerberos
-
- Issue: Azure/S3 authentication failures
-
-
Check:
-
Credentials are correct
-
Libraries are in classpath (
hadoop-azure,hadoop-aws) -
Configuration keys are properly formatted
-
- Azure
Example:
# Correct format for storage account key xasecure.audit.destination.hdfs.config.fs.azure.account.key.STORAGEACCOUNT.blob.core.windows.net=KEY - S3
Example:
# Correct S3A properties xasecure.audit.destination.hdfs.config.fs.s3a.access.key=ACCESSKEY xasecure.audit.destination.hdfs.config.fs.s3a.secret.key=SECRETKEY
-
