VAULT-12264: Fix log rotation params which require an integer (#18666)

* integer values for some log flags
* Adjusted `log_flags` to expect `int` for max files and max bytes
* Updated `server` and `agent`
 Renamed updateConfig (and updateLogConfig)
* Added int log params to test
* Adjust config/params so we can identify when they're not present
* Removed pointer confusion
This commit is contained in:
Peter Wilson
2023-01-11 20:04:57 +00:00
committed by GitHub
parent 49da2544ce
commit 8abcde7cbb
9 changed files with 157 additions and 126 deletions

View File

@@ -38,12 +38,14 @@ type SharedConfig struct {
// LogFormat specifies the log format. Valid values are "standard" and
// "json". The values are case-insenstive. If no log format is specified,
// then standard format will be used.
LogFormat string `hcl:"log_format"`
LogLevel string `hcl:"log_level"`
LogFile string `hcl:"log_file"`
LogRotateBytes string `hcl:"log_rotate_bytes"`
LogRotateDuration string `hcl:"log_rotate_duration"`
LogRotateMaxFiles string `hcl:"log_rotate_max_files"`
LogFormat string `hcl:"log_format"`
LogLevel string `hcl:"log_level"`
LogFile string `hcl:"log_file"`
LogRotateDuration string `hcl:"log_rotate_duration"`
LogRotateBytes int `hcl:"log_rotate_bytes"`
LogRotateBytesRaw interface{} `hcl:"log_rotate_bytes"`
LogRotateMaxFiles int `hcl:"log_rotate_max_files"`
LogRotateMaxFilesRaw interface{} `hcl:"log_rotate_max_files"`
PidFile string `hcl:"pid_file"`

View File

@@ -69,13 +69,15 @@ func (c *SharedConfig) Merge(c2 *SharedConfig) *SharedConfig {
}
result.LogRotateBytes = c.LogRotateBytes
if c2.LogRotateBytes != "" {
if c2.LogRotateBytesRaw != nil {
result.LogRotateBytes = c2.LogRotateBytes
result.LogRotateBytesRaw = c2.LogRotateBytesRaw
}
result.LogRotateMaxFiles = c.LogRotateMaxFiles
if c2.LogRotateMaxFiles != "" {
if c2.LogRotateMaxFilesRaw != nil {
result.LogRotateMaxFiles = c2.LogRotateMaxFiles
result.LogRotateMaxFilesRaw = c2.LogRotateMaxFilesRaw
}
result.LogRotateDuration = c.LogRotateDuration