Adjust the audit_log_ext column size to keep align with audit_log table (#21678)

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
This commit is contained in:
stonezdj(Daojun Zhang) 2025-02-27 18:17:04 +08:00 committed by GitHub
parent 5c39e76ac4
commit b9528d8deb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 6 deletions

View File

@ -6,10 +6,10 @@ CREATE TABLE IF NOT EXISTS audit_log_ext
id BIGSERIAL PRIMARY KEY NOT NULL,
project_id BIGINT,
operation VARCHAR(50) NULL,
resource_type VARCHAR(50) NULL,
resource VARCHAR(50) NULL,
username VARCHAR(50) NULL,
op_desc VARCHAR(500) NULL,
resource_type VARCHAR(255) NULL,
resource VARCHAR(1024) NULL,
username VARCHAR(255) NULL,
op_desc VARCHAR(1024) NULL,
op_result BOOLEAN DEFAULT true,
payload TEXT NULL,
source_ip VARCHAR(50) NULL,

View File

@ -65,7 +65,7 @@ func (h *Handler) Handle(ctx context.Context, value interface{}) error {
if auditLog != nil && config.AuditLogEventEnabled(ctx, fmt.Sprintf("%v_%v", auditLog.Operation, auditLog.ResourceType)) {
_, err := auditext.Mgr.Create(ctx, auditLog)
if err != nil {
log.Debugf("add audit log err: %v", err)
log.Infof("add audit log err: %v", err)
}
}
}

View File

@ -36,7 +36,9 @@ func init() {
commonevent.RegisterResolver(`/api/v2.0/configurations`, configureEventResolver)
}
const payloadSizeLimit = 450
// payloadSizeLimit max size allowed in the op_desc
// the size of audit_log_ext's op_desc - 50
const payloadSizeLimit = 950
// resolver used to resolve the configuration event
type resolver struct {