Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate default settings for logging.file.* #17332

Merged
merged 1 commit into from
Mar 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions libbeat/logp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ type FileConfig struct {
RedirectStderr bool `config:"redirect_stderr"`
}

const defaultLevel = InfoLevel

// DefaultConfig returns the default config options for a given environment the
// Beat is supposed to be run within.
func DefaultConfig(environment Environment) Config {
Expand All @@ -70,23 +72,28 @@ func DefaultConfig(environment Environment) Config {

func defaultToStderrConfig() Config {
return Config{
Level: InfoLevel,
Level: defaultLevel,
ToStderr: true,
Files: defaultFileConfig(),
addCaller: true,
}
}

func defaultToFileConfig() Config {
return Config{
Level: InfoLevel,
ToFiles: true,
Files: FileConfig{
MaxSize: 10 * 1024 * 1024,
MaxBackups: 7,
Permissions: 0600,
Interval: 0,
RotateOnStartup: true,
},
Level: defaultLevel,
ToFiles: true,
Files: defaultFileConfig(),
addCaller: true,
}
}

func defaultFileConfig() FileConfig {
return FileConfig{
MaxSize: 10 * 1024 * 1024,
MaxBackups: 7,
Permissions: 0600,
Interval: 0,
RotateOnStartup: true,
}
}