默认100毫秒刷一次盘,可以通过--output-file-flush-interval
func NewFileOutput(pathTemplate string, config *FileOutputConfig) *FileOutput { o := new(FileOutput) o.pathTemplate = pathTemplate o.config = config o.updateName() if strings.Contains(pathTemplate, "%r") { o.requestPerFile = true } if config.FlushInterval == 0 { config.FlushInterval = 100 * time.Millisecond } go func() { for { time.Sleep(config.FlushInterval) if o.IsClosed() { break } o.updateName() o.flush() } }() return o }