private AuditLog saveToDb(AuditLogable auditLogable, AuditLogType logType, String loggerString) { AuditLog auditLog = create(auditLogable, logType, loggerString); if (auditLog == null) { return null; } auditLogable.setPropertiesForAuditLog(auditLog); // truncate user name auditLog.setUserName(StringUtils.abbreviate(auditLog.getUserName(), USERNAME_LENGTH)); TransactionSupport.executeInNewTransaction(() -> { auditLogDao.save(auditLog); return null; }); return auditLog; }
public AuditLogableBase(final AuditLog auditLog) { this(auditLog.getVdsId(), auditLog.getVmId()); this.storageDomainId = auditLog.getStorageDomainId(); this.storagePoolId = auditLog.getStoragePoolId(); this.correlationId = auditLog.getCorrelationId(); this.customData = auditLog.getCustomData(); this.customEventId = auditLog.getCustomEventId(); this.eventFloodInSec = auditLog.getEventFloodInSec(); this.glusterVolumeId = auditLog.getGlusterVolumeId(); this.glusterVolumeName = auditLog.getGlusterVolumeName(); this.jobId = auditLog.getJobId(); this.userId = auditLog.getUserId(); this.userName = auditLog.getUserName(); this.clusterId = auditLog.getClusterId(); this.vdsName = auditLog.getVdsName(); this.vmName = auditLog.getVmName(); this.vmTemplateId = auditLog.getVmTemplateId(); this.vmTemplateName = auditLog.getVmTemplateName(); this.origin = auditLog.getOrigin(); this.external = auditLog.isExternal(); this.callStack = auditLog.getCallStack(); this.brickId = auditLog.getBrickId(); this.brickPath = auditLog.getBrickPath(); }
boolean nameValid = !StringUtils.isEmpty(entity.getUserName()); user.setName(entity.getUserName());
.addValue("message", event.getMessage()) .addValue("user_id", event.getUserId()) .addValue("user_name", event.getUserName()) .addValue("vds_id", event.getVdsId()) .addValue("vds_name", event.getVdsName())