Skip to content

Commit

Permalink
Remove deprecated config options force_close_files and close_older (#…
Browse files Browse the repository at this point in the history
…3768)

The new close_* options must be used instead.
  • Loading branch information
ruflin authored and exekias committed Mar 31, 2017
1 parent a083077 commit 7d424ae
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 80 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ https://github.com/elastic/beats/compare/v5.1.1...master[Check the HEAD diff]
*Filebeat*
- Always use absolute path for event and registry. This can lead to issues when relative paths were used before. {pull}3328[3328]
- Remove code to convert states from 1.x. {pull}3767[3767]
- Remove deprecated config options force_close_files and close_older. {pull}3768[3768]

*Heartbeat*

Expand Down
71 changes: 27 additions & 44 deletions filebeat/harvester/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,65 +6,48 @@ import (

cfg "github.com/elastic/beats/filebeat/config"
"github.com/elastic/beats/filebeat/harvester/reader"
"github.com/elastic/beats/libbeat/logp"

"github.com/dustin/go-humanize"
"github.com/elastic/beats/libbeat/common/match"
)

var (
defaultConfig = harvesterConfig{
BufferSize: 16 * humanize.KiByte,
InputType: cfg.DefaultInputType,
Backoff: 1 * time.Second,
BackoffFactor: 2,
MaxBackoff: 10 * time.Second,
CloseInactive: 5 * time.Minute,
MaxBytes: 10 * humanize.MiByte,
CloseRemoved: true,
CloseRenamed: false,
CloseEOF: false,
CloseTimeout: 0,
ForceCloseFiles: false,
BufferSize: 16 * humanize.KiByte,
InputType: cfg.DefaultInputType,
Backoff: 1 * time.Second,
BackoffFactor: 2,
MaxBackoff: 10 * time.Second,
CloseInactive: 5 * time.Minute,
MaxBytes: 10 * humanize.MiByte,
CloseRemoved: true,
CloseRenamed: false,
CloseEOF: false,
CloseTimeout: 0,
}
)

type harvesterConfig struct {
BufferSize int `config:"harvester_buffer_size"`
Encoding string `config:"encoding"`
InputType string `config:"input_type"`
Backoff time.Duration `config:"backoff" validate:"min=0,nonzero"`
BackoffFactor int `config:"backoff_factor" validate:"min=1"`
MaxBackoff time.Duration `config:"max_backoff" validate:"min=0,nonzero"`
CloseInactive time.Duration `config:"close_inactive"`
CloseOlder time.Duration `config:"close_older"`
CloseRemoved bool `config:"close_removed"`
CloseRenamed bool `config:"close_renamed"`
CloseEOF bool `config:"close_eof"`
CloseTimeout time.Duration `config:"close_timeout" validate:"min=0"`
ForceCloseFiles bool `config:"force_close_files"`
ExcludeLines []match.Matcher `config:"exclude_lines"`
IncludeLines []match.Matcher `config:"include_lines"`
MaxBytes int `config:"max_bytes" validate:"min=0,nonzero"`
Multiline *reader.MultilineConfig `config:"multiline"`
JSON *reader.JSONConfig `config:"json"`
BufferSize int `config:"harvester_buffer_size"`
Encoding string `config:"encoding"`
InputType string `config:"input_type"`
Backoff time.Duration `config:"backoff" validate:"min=0,nonzero"`
BackoffFactor int `config:"backoff_factor" validate:"min=1"`
MaxBackoff time.Duration `config:"max_backoff" validate:"min=0,nonzero"`
CloseInactive time.Duration `config:"close_inactive"`
CloseRemoved bool `config:"close_removed"`
CloseRenamed bool `config:"close_renamed"`
CloseEOF bool `config:"close_eof"`
CloseTimeout time.Duration `config:"close_timeout" validate:"min=0"`
ExcludeLines []match.Matcher `config:"exclude_lines"`
IncludeLines []match.Matcher `config:"include_lines"`
MaxBytes int `config:"max_bytes" validate:"min=0,nonzero"`
Multiline *reader.MultilineConfig `config:"multiline"`
JSON *reader.JSONConfig `config:"json"`
}

func (config *harvesterConfig) Validate() error {

// DEPRECATED: remove in 6.0
if config.ForceCloseFiles {
config.CloseRemoved = true
config.CloseRenamed = true
logp.Warn("DEPRECATED: force_close_files was set to true. Use close_removed + close_rename")
}

// DEPRECATED: remove in 6.0
if config.CloseOlder > 0 {
config.CloseInactive = config.CloseOlder
logp.Warn("DEPRECATED: close_older is deprecated. Use close_inactive")
}

// Check input type
if _, ok := cfg.ValidInputType[config.InputType]; !ok {
return fmt.Errorf("Invalid input type: %v", config.InputType)
Expand Down
35 changes: 0 additions & 35 deletions filebeat/harvester/config_test.go

This file was deleted.

1 change: 0 additions & 1 deletion filebeat/tests/system/config/filebeat.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ filebeat.prospectors:
close_renamed: {{close_renamed}}
close_eof: {{close_eof}}
close_timeout: {{close_timeout}}
force_close_files: {{force_close_files}}
clean_inactive: {{clean_inactive}}
clean_removed: {{clean_removed}}
harvester_limit: {{harvester_limit | default(0) }}
Expand Down

0 comments on commit 7d424ae

Please sign in to comment.