Search in sources :

Example 1 with AuditLogEvent

use of com.netflix.titus.api.audit.model.AuditLogEvent in project titus-control-plane by Netflix.

the class AuditEventDiskWriter method writeLog.

private void writeLog() {
    try {
        if (logWriter == null) {
            createAuditLogFolder(auditLogFolder);
            logWriter = new BufferedWriter(new FileWriter(auditLogFile, true));
        }
        for (AuditLogEvent event = eventQueue.poll(); event != null; event = eventQueue.poll()) {
            logWriter.write(formatEvent(event));
            logWriter.write('\n');
        }
        for (UserRequestEvent event = eventBusQueue.poll(); event != null; event = eventBusQueue.poll()) {
            logWriter.write(formatEvent(event));
            logWriter.write('\n');
        }
        logWriter.flush();
    } catch (Exception e) {
        logger.warn("Audit log write to disk failure ({})", e.getMessage());
    }
}
Also used : AuditLogEvent(com.netflix.titus.api.audit.model.AuditLogEvent) UserRequestEvent(com.netflix.titus.api.model.event.UserRequestEvent) FileWriter(java.io.FileWriter) BufferedWriter(java.io.BufferedWriter)

Aggregations

AuditLogEvent (com.netflix.titus.api.audit.model.AuditLogEvent)1 UserRequestEvent (com.netflix.titus.api.model.event.UserRequestEvent)1 BufferedWriter (java.io.BufferedWriter)1 FileWriter (java.io.FileWriter)1