Update logfile documentation

This commit is contained in:
Daniel Nelson
2019-05-03 10:55:11 -07:00
parent bcf7516a23
commit 74c9d7ace2
2 changed files with 55 additions and 43 deletions

View File

@@ -72,9 +72,10 @@ func NewConfig() *Config {
c := &Config{
// Agent defaults:
Agent: &AgentConfig{
Interval: internal.Duration{Duration: 10 * time.Second},
RoundInterval: true,
FlushInterval: internal.Duration{Duration: 10 * time.Second},
Interval: internal.Duration{Duration: 10 * time.Second},
RoundInterval: true,
FlushInterval: internal.Duration{Duration: 10 * time.Second},
LogfileRotationMaxArchives: 5,
},
Tags: make(map[string]string),
@@ -140,22 +141,26 @@ type AgentConfig struct {
UTC bool `toml:"utc"`
// Debug is the option for running in debug mode
Debug bool
// Logfile specifies the file to send logs to
Logfile string
// The log file rotation interval
LogfileRotationInterval internal.Duration
// The log file max size. Logs will rotated when they exceed this size.
LogfileRotationMaxSize internal.Size
// The max number of log archives to keep
LogfileRotationMaxArchives int
Debug bool `toml:"debug"`
// Quiet is the option for running in quiet mode
Quiet bool
Quiet bool `toml:"quiet"`
// Log file name, the empty string means to log to stderr.
Logfile string `toml:"logfile"`
// The logfile will be rotated when it becomes larger than the specified
// size. When set to 0 no size based rotation is performed.
LogfileRotationInterval internal.Duration `toml:"logfile_rotation_interval"`
// Maximum number of rotated archives to keep, any older logs are deleted.
// If set to -1, no archives are removed.
LogfileRotationMaxSize internal.Size `toml:"logfile_rotation_max_size"`
// Maximum number of rotated archives to keep, any older logs are deleted.
// If set to -1, no archives are removed.
LogfileRotationMaxArchives int `toml:"logfile_rotation_max_archives"`
Hostname string
OmitHostname bool
}
@@ -275,24 +280,25 @@ var agentConfig = `
## Valid time units are "ns", "us" (or "µs"), "ms", "s".
precision = ""
## Logging configuration:
## Run telegraf with debug log messages.
debug = false
## Run telegraf in quiet mode (error log messages only).
quiet = false
## Specify the log file name. The empty string means to log to stderr.
logfile = ""
## Rotation settings, only applicable when log file name is specified.
## Log file rotation time interval, e.g. "1d" means logs will rotated every day. Default is 0 => no rotation based on time.
# logfile_rotation_interval = "1d"
## The log file max size. Log files will be rotated when they exceed this size. Default is 0 => no rotation based on file size.
# logfile_rotation_max_size = "10 MB"
## Maximum number of archives (rotated) files to keep. Older log files are deleted first.
## This setting is only applicable if logfile_rotation_interval and/or logfile_rotation_max_size settings have been specified (otherwise there is no rotation)
## Default is 0 => all rotated files are deleted.
## Use -1 to keep all archives.
## Analogous to logrotate "rotate" setting http://man7.org/linux/man-pages/man8/logrotate.8.html
# logfile_rotation_max_archives = 0
## Log at debug level.
# debug = false
## Log only error level messages.
# quiet = false
## Log file name, the empty string means to log to stderr.
# logfile = ""
## The logfile will be rotated after the time interval specified. When set
## to 0 no time based rotation is performed.
# logfile_rotation_interval = "0d"
## The logfile will be rotated when it becomes larger than the specified
## size. When set to 0 no size based rotation is performed.
# logfile_rotation_max_size = "0MB"
## Maximum number of rotated archives to keep, any older logs are deleted.
## If set to -1, no archives are removed.
# logfile_rotation_max_archives = 5
## Override default hostname, if empty use os.Hostname()
hostname = ""