MM-22273 New auditing system (phase 1) (#13967)
* New auditing API outputting to syslog via TLS * New config section for specifying remote syslog server IP, port, and cert. * Legacy audit API retained for access history feature
Этот коммит содержится в:
37
audit/record.go
Обычный файл
37
audit/record.go
Обычный файл
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package audit
|
||||
|
||||
// Meta represents metadata that can be added to a audit record as name/value pairs.
|
||||
type Meta map[string]interface{}
|
||||
|
||||
// Record provides a consistent set of fields used for all audit logging.
|
||||
type Record struct {
|
||||
APIPath string
|
||||
Event string
|
||||
Status string
|
||||
UserID string
|
||||
SessionID string
|
||||
Client string
|
||||
IPAddress string
|
||||
Meta Meta
|
||||
}
|
||||
|
||||
// Success marks the audit record status as successful.
|
||||
func (rec *Record) Success() {
|
||||
rec.Status = Success
|
||||
}
|
||||
|
||||
// Success marks the audit record status as failed.
|
||||
func (rec *Record) Fail() {
|
||||
rec.Status = Fail
|
||||
}
|
||||
|
||||
// AddMeta adds a single name/value pair to this audit record's metadata.
|
||||
func (rec *Record) AddMeta(name string, val interface{}) {
|
||||
if rec.Meta == nil {
|
||||
rec.Meta = Meta{}
|
||||
}
|
||||
rec.Meta[name] = val
|
||||
}
|
||||
Ссылка в новой задаче
Block a user