Skip to content

Commit

Permalink
Update force flush default (#261)
Browse files Browse the repository at this point in the history
* Increase default flush period

* Update tests

* Update doc

* Update for consistency
  • Loading branch information
Mrod1598 authored Sep 7, 2021
1 parent cfff3b0 commit d0c9d8d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/operators/file_input.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The `file_input` operator reads logs from files. It will place the lines read in
| `exclude` | [] | A list of file glob patterns to exclude from reading |
| `poll_interval` | 200ms | The duration between filesystem polls |
| `multiline` | | A `multiline` configuration block. See below for details |
| `force_flush_period` | `0s` | Time since last read of data from file, after which currently buffered log should be send to pipeline. Takes [duration](../types/duration.md) as value. Zero means waiting for new data forever |
| `force_flush_period` | `500ms` | Time since last read of data from file, after which currently buffered log should be send to pipeline. Takes [duration](../types/duration.md) as value. Zero means waiting for new data forever |
| `write_to` | `$body` | The body [field](/docs/types/field.md) written to when creating a new log entry |
| `encoding` | `utf-8` | The encoding of the file being read. See the list of supported encodings below for available options |
| `include_file_name` | `true` | Whether to add the file name as the attribute `file.name` |
Expand Down
4 changes: 4 additions & 0 deletions operator/builtin/input/file/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ func TestMapStructureDecodeConfigWithHook(t *testing.T) {
"line_start_pattern": expect.Splitter.Multiline.LineStartPattern,
"line_end_pattern": expect.Splitter.Multiline.LineEndPattern,
},
"force_flush_period": 0.5,
"include_file_name": true,
"include_file_path": false,
"start_at": "end",
Expand Down Expand Up @@ -749,6 +750,9 @@ func TestMapStructureDecodeConfig(t *testing.T) {
"max_log_size": 1024 * 1024,
"max_concurrent_files": 1024,
"encoding": "utf16",
"force_flush_period": map[string]interface{}{
"Duration": 500 * 1000 * 1000,
},
}

var actual InputConfig
Expand Down
2 changes: 1 addition & 1 deletion operator/helper/multiline.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type FlusherConfig struct {
func NewFlusherConfig() FlusherConfig {
return FlusherConfig{
// Empty or `0s` means that we will never force flush
Period: Duration{Duration: 0},
Period: Duration{Duration: time.Millisecond * 500},
}
}

Expand Down

0 comments on commit d0c9d8d

Please sign in to comment.