Search in sources :

Example 1 with LocalFileLogBuffer

use of org.apache.ranger.audit.provider.LocalFileLogBuffer 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);
}
Also used : DebugTracer(org.apache.ranger.audit.provider.DebugTracer) LocalFileLogBuffer(org.apache.ranger.audit.provider.LocalFileLogBuffer) AuditEventBase(org.apache.ranger.audit.model.AuditEventBase) Log4jTracer(org.apache.ranger.audit.provider.Log4jTracer)

Aggregations

AuditEventBase (org.apache.ranger.audit.model.AuditEventBase)1 DebugTracer (org.apache.ranger.audit.provider.DebugTracer)1 LocalFileLogBuffer (org.apache.ranger.audit.provider.LocalFileLogBuffer)1 Log4jTracer (org.apache.ranger.audit.provider.Log4jTracer)1