MM-22784 Advanced logging config for audit (#15076)

Adds the advanced logging config for audit. Existing support for auditing to a single file remains for E0 and E10 licenses instances, and a new config item ExperimentalAuditSettings.AdvancedLoggingConfig is added that behaves like LogSettings.AdvancedLoggingConfig.

Supported destinations:

- file
- syslog (with out without TLS)
- raw TCP socket (with out without TLS)

ExperimentalAuditSettings.AdvancedLoggingConfig can contain a filespec to a config file, a database DSN, or JSON.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Claudio Costa <cstcld91@gmail.com>
Этот коммит содержится в:
Doug Lauder
2020-07-22 18:48:46 -04:00
коммит произвёл GitHub
родитель b372b98aca
Коммит 56fb31f06f
12 изменённых файлов: 144 добавлений и 157 удалений

Просмотреть файл

@@ -1117,52 +1117,17 @@ func (s *LogSettings) SetDefaults() {
}
type ExperimentalAuditSettings struct {
SysLogEnabled *bool `restricted:"true"`
SysLogIP *string `restricted:"true"`
SysLogPort *int `restricted:"true"`
SysLogTag *string `restricted:"true"`
SysLogCert *string `restricted:"true"`
SysLogInsecure *bool `restricted:"true"`
SysLogMaxQueueSize *int `restricted:"true"`
FileEnabled *bool `restricted:"true"`
FileName *string `restricted:"true"`
FileMaxSizeMB *int `restricted:"true"`
FileMaxAgeDays *int `restricted:"true"`
FileMaxBackups *int `restricted:"true"`
FileCompress *bool `restricted:"true"`
FileMaxQueueSize *int `restricted:"true"`
FileEnabled *bool `restricted:"true"`
FileName *string `restricted:"true"`
FileMaxSizeMB *int `restricted:"true"`
FileMaxAgeDays *int `restricted:"true"`
FileMaxBackups *int `restricted:"true"`
FileCompress *bool `restricted:"true"`
FileMaxQueueSize *int `restricted:"true"`
AdvancedLoggingConfig *string `restricted:"true"`
}
func (s *ExperimentalAuditSettings) SetDefaults() {
if s.SysLogEnabled == nil {
s.SysLogEnabled = NewBool(false)
}
if s.SysLogIP == nil {
s.SysLogIP = NewString("localhost")
}
if s.SysLogPort == nil {
s.SysLogPort = NewInt(6514)
}
if s.SysLogTag == nil {
s.SysLogTag = NewString("")
}
if s.SysLogCert == nil {
s.SysLogCert = NewString("")
}
if s.SysLogInsecure == nil {
s.SysLogInsecure = NewBool(false)
}
if s.SysLogMaxQueueSize == nil {
s.SysLogMaxQueueSize = NewInt(1000)
}
if s.FileEnabled == nil {
s.FileEnabled = NewBool(false)
}
@@ -1190,16 +1155,21 @@ func (s *ExperimentalAuditSettings) SetDefaults() {
if s.FileMaxQueueSize == nil {
s.FileMaxQueueSize = NewInt(1000)
}
if s.AdvancedLoggingConfig == nil {
s.AdvancedLoggingConfig = NewString("")
}
}
type NotificationLogSettings struct {
EnableConsole *bool `restricted:"true"`
ConsoleLevel *string `restricted:"true"`
ConsoleJson *bool `restricted:"true"`
EnableFile *bool `restricted:"true"`
FileLevel *string `restricted:"true"`
FileJson *bool `restricted:"true"`
FileLocation *string `restricted:"true"`
EnableConsole *bool `restricted:"true"`
ConsoleLevel *string `restricted:"true"`
ConsoleJson *bool `restricted:"true"`
EnableFile *bool `restricted:"true"`
FileLevel *string `restricted:"true"`
FileJson *bool `restricted:"true"`
FileLocation *string `restricted:"true"`
AdvancedLoggingConfig *string `restricted:"true"`
}
func (s *NotificationLogSettings) SetDefaults() {
@@ -1230,6 +1200,10 @@ func (s *NotificationLogSettings) SetDefaults() {
if s.FileJson == nil {
s.FileJson = NewBool(true)
}
if s.AdvancedLoggingConfig == nil {
s.AdvancedLoggingConfig = NewString("")
}
}
type PasswordSettings struct {