use of org.apache.ranger.audit.provider.DebugTracer in project ranger by apache.
the class HdfsAuditProvider method init.
public void init(Properties props) {
LOG.info("HdfsAuditProvider.init()");
super.init(props);
Map<String, String> hdfsProps = MiscUtil.getPropertiesWithPrefix(props, "xasecure.audit.hdfs.config.");
String encoding = hdfsProps.get("encoding");
String hdfsDestinationDirectory = hdfsProps.get("destination.directory");
String hdfsDestinationFile = hdfsProps.get("destination.file");
int hdfsDestinationFlushIntervalSeconds = MiscUtil.parseInteger(hdfsProps.get("destination.flush.interval.seconds"), 15 * 60);
int hdfsDestinationRolloverIntervalSeconds = MiscUtil.parseInteger(hdfsProps.get("destination.rollover.interval.seconds"), 24 * 60 * 60);
int hdfsDestinationOpenRetryIntervalSeconds = MiscUtil.parseInteger(hdfsProps.get("destination.open.retry.interval.seconds"), 60);
String localFileBufferDirectory = hdfsProps.get("local.buffer.directory");
String localFileBufferFile = hdfsProps.get("local.buffer.file");
int localFileBufferFlushIntervalSeconds = MiscUtil.parseInteger(hdfsProps.get("local.buffer.flush.interval.seconds"), 1 * 60);
int localFileBufferFileBufferSizeBytes = MiscUtil.parseInteger(hdfsProps.get("local.buffer.file.buffer.size.bytes"), 8 * 1024);
int localFileBufferRolloverIntervalSeconds = MiscUtil.parseInteger(hdfsProps.get("local.buffer.rollover.interval.seconds"), 10 * 60);
String localFileBufferArchiveDirectory = hdfsProps.get("local.archive.directory");
int localFileBufferArchiveFileCount = MiscUtil.parseInteger(hdfsProps.get("local.archive.max.file.count"), 10);
// Added for Azure. Note that exact name of these properties is not known as it contains the variable account name in it.
Map<String, String> configProps = MiscUtil.getPropertiesWithPrefix(props, "xasecure.audit.destination.hdfs.config.");
DebugTracer tracer = new Log4jTracer(LOG);
HdfsLogDestination<AuditEventBase> mHdfsDestination = new HdfsLogDestination<AuditEventBase>(tracer);
mHdfsDestination.setDirectory(hdfsDestinationDirectory);
mHdfsDestination.setFile(hdfsDestinationFile);
mHdfsDestination.setFlushIntervalSeconds(hdfsDestinationFlushIntervalSeconds);
mHdfsDestination.setEncoding(encoding);
mHdfsDestination.setRolloverIntervalSeconds(hdfsDestinationRolloverIntervalSeconds);
mHdfsDestination.setOpenRetryIntervalSeconds(hdfsDestinationOpenRetryIntervalSeconds);
mHdfsDestination.setConfigProps(configProps);
LocalFileLogBuffer<AuditEventBase> mLocalFileBuffer = new LocalFileLogBuffer<AuditEventBase>(tracer);
mLocalFileBuffer.setDirectory(localFileBufferDirectory);
mLocalFileBuffer.setFile(localFileBufferFile);
mLocalFileBuffer.setFlushIntervalSeconds(localFileBufferFlushIntervalSeconds);
mLocalFileBuffer.setFileBufferSizeBytes(localFileBufferFileBufferSizeBytes);
mLocalFileBuffer.setEncoding(encoding);
mLocalFileBuffer.setRolloverIntervalSeconds(localFileBufferRolloverIntervalSeconds);
mLocalFileBuffer.setArchiveDirectory(localFileBufferArchiveDirectory);
mLocalFileBuffer.setArchiveFileCount(localFileBufferArchiveFileCount);
setBufferAndDestination(mLocalFileBuffer, mHdfsDestination);
}
Aggregations