|
@@ -82,6 +82,7 @@ public class SyslogAuditService {
|
|
|
|
|
|
|
|
|
|
private final Configuration configuration;
|
|
private final Configuration configuration;
|
|
|
|
+ private List<SyslogIF> syslogInstances = new ArrayList<>();
|
|
|
|
|
|
public SyslogAuditService(final PwmApplication pwmApplication)
|
|
public SyslogAuditService(final PwmApplication pwmApplication)
|
|
throws LocalDBException
|
|
throws LocalDBException
|
|
@@ -89,14 +90,17 @@ public class SyslogAuditService {
|
|
this.configuration = pwmApplication.getConfig();
|
|
this.configuration = pwmApplication.getConfig();
|
|
this.certificates = configuration.readSettingAsCertificate(PwmSetting.AUDIT_SYSLOG_CERTIFICATES);
|
|
this.certificates = configuration.readSettingAsCertificate(PwmSetting.AUDIT_SYSLOG_CERTIFICATES);
|
|
|
|
|
|
- final String syslogConfigString = configuration.readSettingAsString(PwmSetting.AUDIT_SYSLOG_SERVERS);
|
|
|
|
- final SyslogConfig syslogConfig;
|
|
|
|
|
|
+ final List<String> syslogConfigStringArray = configuration.readSettingAsStringArray(PwmSetting.AUDIT_SYSLOG_SERVERS);
|
|
|
|
+
|
|
try {
|
|
try {
|
|
- syslogConfig = SyslogConfig.fromConfigString(syslogConfigString);
|
|
|
|
- syslogInstance = makeSyslogInstance(syslogConfig);
|
|
|
|
- LOGGER.trace("queued service running for " + syslogConfig);
|
|
|
|
|
|
+ for(String entry : syslogConfigStringArray) {
|
|
|
|
+ final SyslogConfig syslogCfg = SyslogConfig.fromConfigString(entry);
|
|
|
|
+ final SyslogIF syslogInstance = makeSyslogInstance(syslogCfg);
|
|
|
|
+ syslogInstances.add(syslogInstance);
|
|
|
|
+ }
|
|
|
|
+ LOGGER.trace("queued service running for syslog entries");
|
|
} catch (IllegalArgumentException e) {
|
|
} catch (IllegalArgumentException e) {
|
|
- LOGGER.error("error parsing syslog configuration for '" + syslogConfigString + "', error: " + e.getMessage());
|
|
|
|
|
|
+ LOGGER.error("error parsing syslog configuration for syslogConfigStrings ERROR: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
final WorkQueueProcessor.Settings settings = WorkQueueProcessor.Settings.builder()
|
|
final WorkQueueProcessor.Settings settings = WorkQueueProcessor.Settings.builder()
|
|
@@ -188,19 +192,19 @@ public class SyslogAuditService {
|
|
|
|
|
|
private WorkQueueProcessor.ProcessResult processEvent(final String auditRecord) {
|
|
private WorkQueueProcessor.ProcessResult processEvent(final String auditRecord) {
|
|
|
|
|
|
- final SyslogIF syslogIF = syslogInstance;
|
|
|
|
- try {
|
|
|
|
- syslogIF.info(auditRecord);
|
|
|
|
- LOGGER.trace("delivered syslog audit event: " + auditRecord);
|
|
|
|
- lastError = null;
|
|
|
|
- return WorkQueueProcessor.ProcessResult.SUCCESS;
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- final String errorMsg = "error while sending syslog message to remote service: " + e.getMessage();
|
|
|
|
- final ErrorInformation errorInformation = new ErrorInformation(PwmError.ERROR_SYSLOG_WRITE_ERROR, errorMsg, new String[]{e.getMessage()});
|
|
|
|
- lastError = errorInformation;
|
|
|
|
- LOGGER.error(errorInformation.toDebugStr());
|
|
|
|
|
|
+ for(SyslogIF syslogInstance : syslogInstances) {
|
|
|
|
+ try {
|
|
|
|
+ syslogInstance.info(auditRecord);
|
|
|
|
+ LOGGER.trace("delivered syslog audit event: " + auditRecord);
|
|
|
|
+ lastError = null;
|
|
|
|
+ return WorkQueueProcessor.ProcessResult.SUCCESS;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ final String errorMsg = "error while sending syslog message to remote service: " + e.getMessage();
|
|
|
|
+ final ErrorInformation errorInformation = new ErrorInformation(PwmError.ERROR_SYSLOG_WRITE_ERROR, errorMsg, new String[]{e.getMessage()});
|
|
|
|
+ lastError = errorInformation;
|
|
|
|
+ LOGGER.error(errorInformation.toDebugStr());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
return WorkQueueProcessor.ProcessResult.RETRY;
|
|
return WorkQueueProcessor.ProcessResult.RETRY;
|
|
}
|
|
}
|
|
|
|
|