Skip to content

Commit

Permalink
Invert the flag & add fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
loyispa committed Nov 25, 2021
1 parent 11557f2 commit 0313785
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions cmd/mtail/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ var (
logRuntimeErrors = flag.Bool("vm_logs_runtime_errors", true, "Enables logging of runtime errors to the standard log. Set to false to only have the errors printed to the HTTP console.")

// Ops flags.
pollInterval = flag.Duration("poll_interval", 250*time.Millisecond, "Set the interval to poll all log files for list; must be positive, or zero to disable polling. With polling mode, only the files found at mtail startup will be polled.")
pollLogInterval = flag.Duration("poll_log_interval", 250*time.Millisecond, "Set the interval to poll all log files for data; must be positive, or zero to disable polling. With polling mode, only the files found at mtail startup will be polled.")
pollInterval = flag.Duration("poll_interval", 250*time.Millisecond, "Set the interval to poll each log file for data; must be positive, or zero to disable polling. With polling mode, only the files found at mtail startup will be polled.")
pollLogInterval = flag.Duration("poll_log_interval", 250*time.Millisecond, "Set the interval to find all matched log files for polling; must be positive, or zero to disable polling. With polling mode, only the files found at mtail startup will be polled.")
expiredMetricGcTickInterval = flag.Duration("expired_metrics_gc_interval", time.Hour, "interval between expired metric garbage collection runs")
staleLogGcTickInterval = flag.Duration("stale_log_gc_interval", time.Hour, "interval between stale log garbage collection runs")
metricPushInterval = flag.Duration("metric_push_interval", time.Minute, "interval between metric pushes to passive collectors")
Expand Down Expand Up @@ -145,12 +145,12 @@ func main() {
trace.ApplyConfig(trace.Config{DefaultSampler: trace.ProbabilitySampler(1 / float64(*traceSamplePeriod))})
}
if *pollInterval == 0 {
glog.Infof("no poll interval specified; defaulting to 250ms poll")
glog.Infof("no poll log data interval specified; defaulting to 250ms poll")
*pollInterval = time.Millisecond * 250
}
if *pollLogInterval == 0 {
glog.Infof("no poll interval specified; defaulting to pollInterval")
*pollLogInterval = *pollInterval
glog.Infof("no poll log pattern interval specified; defaulting to 250ms poll")
*pollLogInterval = time.Millisecond * 250
}

ctx, cancel := context.WithCancel(context.Background())
Expand Down Expand Up @@ -183,8 +183,8 @@ func main() {
opts = append(opts, mtail.StaleLogGcWaker(staleLogGcWaker))
}
if *pollInterval > 0 {
logPatternPollWaker := waker.NewTimed(ctx, *pollInterval)
logStreamPollWaker := waker.NewTimed(ctx, *pollLogInterval)
logStreamPollWaker := waker.NewTimed(ctx, *pollInterval)
logPatternPollWaker := waker.NewTimed(ctx, *pollLogInterval)
opts = append(opts, mtail.LogPatternPollWaker(logPatternPollWaker), mtail.LogstreamPollWaker(logStreamPollWaker))
}
if *unixSocket == "" {
Expand Down
6 changes: 3 additions & 3 deletions docs/Deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ want to tail. This includes named pipes.

### Polling the file system

`mtail` polls every `--poll_interval`, or 250ms by default, the supplied `--logs` patterns for newly created or deleted log pathnames.
`mtail` polls matched log files every `--poll_log_interval`, or 250ms by default, the supplied `--logs` patterns for newly created or deleted log pathnames.

Known and active logs are read until EOF every 250ms by default.
Known and active logs are read until EOF every `--poll_interval`, or 250ms by default.

Example:
```
mtail --progs /etc/mtail --logs /var/log/syslog --poll_interval 250ms
mtail --progs /etc/mtail --logs /var/log/syslog --poll_interval 250ms --poll_log_interval 250ms
```


Expand Down

0 comments on commit 0313785

Please sign in to comment.