Skip to content

Commit

Permalink
Deprecate document_type in filebeat 5.5
Browse files Browse the repository at this point in the history
`_type` is removed in elasticsearch 6.0 and `document_type` is removed in filebeat 6.0. Use `fields` instead.
  • Loading branch information
ruflin committed May 9, 2017
1 parent 40ab972 commit 2be852a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ https://github.com/elastic/beats/compare/v5.3.0...master[Check the HEAD diff]
*Affecting all Beats*

*Filebeat*
- Deprecate `document_type` prospector config option as _type is removed in elasticsearch 6.0. Use fields instead. {pull}4225[4225]

*Heartbeat*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ The default setting is 10s.

===== document_type

deprecated[5.5,Use `fields` instead]

The event type to use for published lines read by harvesters. For Elasticsearch
output, the value that you specify here is used to set the `type` field in the output
document. The default value is `log`.
Expand Down
8 changes: 8 additions & 0 deletions filebeat/harvester/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package harvester

import (
"fmt"
"sync"
"time"

cfg "github.com/elastic/beats/filebeat/config"
Expand Down Expand Up @@ -57,6 +58,8 @@ type harvesterConfig struct {
Fileset string `config:"_fileset_name"` // hidden option to set the fileset name
}

var onceCheck sync.Once

func (config *harvesterConfig) Validate() error {

// DEPRECATED: remove in 6.0
Expand Down Expand Up @@ -87,5 +90,10 @@ func (config *harvesterConfig) Validate() error {
return fmt.Errorf("When using the JSON decoder and line filtering together, you need to specify a message_key value")
}

if config.DocumentType != "log" {
onceCheck.Do(func() {
logp.Warn("DEPRECATED: document_type is deprecated. Use fields instead.")
})
}
return nil
}

0 comments on commit 2be852a

Please sign in to comment.