Search in sources :

Example 1 with AuditService

use of password.pwm.svc.event.AuditService in project pwm by pwm-project.

the class ExportAuditCommand method doCommand.

@Override
void doCommand() throws Exception {
    final PwmApplication pwmApplication = cliEnvironment.getPwmApplication();
    final AuditService auditManager = new AuditService();
    auditManager.init(pwmApplication);
    JavaHelper.pause(1000);
    final File outputFile = (File) cliEnvironment.getOptions().get(CliParameters.REQUIRED_NEW_OUTPUT_FILE.getName());
    final Instant startTime = Instant.now();
    out("beginning output to " + outputFile.getAbsolutePath());
    final int counter;
    try (FileOutputStream fileOutputStream = new FileOutputStream(outputFile, true)) {
        counter = auditManager.outputVaultToCsv(fileOutputStream, PwmConstants.DEFAULT_LOCALE, false);
        fileOutputStream.close();
    }
    out("completed writing " + counter + " rows of audit output in " + TimeDuration.fromCurrent(startTime).asLongString());
}
Also used : PwmApplication(password.pwm.PwmApplication) Instant(java.time.Instant) FileOutputStream(java.io.FileOutputStream) AuditService(password.pwm.svc.event.AuditService) File(java.io.File)

Aggregations

File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 Instant (java.time.Instant)1 PwmApplication (password.pwm.PwmApplication)1 AuditService (password.pwm.svc.event.AuditService)1