Skip to content

Commit

Permalink
Skip event.dataset and service.type if module is empty (#10526)
Browse files Browse the repository at this point in the history
If Filebeat is only used with an input and now module, both event.dataset and service.type were set with a `.` or empty string. This should not be the case and the fields should be just left out. This PR fixes these two issues.
  • Loading branch information
ruflin authored Feb 4, 2019
1 parent 4e3c0fb commit 6755088
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions filebeat/channel/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ func (f *OutletFactory) Create(p beat.Pipeline, cfg *common.Config, dynFields *c

fields := common.MapStr{}
setMeta(fields, "module", config.Module)
setMeta(fields, "dataset", config.Module+"."+config.Fileset)
if config.Module != "" && config.Fileset != "" {
setMeta(fields, "dataset", config.Module+"."+config.Fileset)
}
if len(fields) > 0 {
fields = common.MapStr{
"event": fields,
Expand All @@ -115,7 +117,7 @@ func (f *OutletFactory) Create(p beat.Pipeline, cfg *common.Config, dynFields *c
}
if config.ServiceType != "" {
fields.Put("service.type", config.ServiceType)
} else {
} else if config.Module != "" {
fields.Put("service.type", config.Module)
}
if config.Type != "" {
Expand Down

0 comments on commit 6755088

Please sign in to comment.