Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Per prospector configurable pipeline #3433

Merged
merged 2 commits into from
Jan 24, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use nil if no pipeline is defined
  • Loading branch information
Tudor Golubenco committed Jan 23, 2017
commit 45695cf5ad00b18f14a56eff02d41f513bdb0841
9 changes: 5 additions & 4 deletions filebeat/input/event.go
Original file line number Diff line number Diff line change
@@ -62,11 +62,12 @@ func (e *Event) ToMapStr() common.MapStr {
// Metadata creates a common.MapStr containing the metadata to
// be associated with the event.
func (e *Event) Metadata() common.MapStr {
meta := common.MapStr{}
if len(e.Pipeline) > 0 {
meta["pipeline"] = e.Pipeline
if e.Pipeline != "" {
return common.MapStr{
"pipeline": e.Pipeline,
}
}
return meta
return nil
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output metadata should also work if meta == nil =>

func (e *Event) Metadata() common.MapStr {
  if e.Pipeline != "" {
    return common.MapStr{
      "pipeline": e.Pipeline,
    }
  }
  return nil

}

This way you don't need to create a map if no pipeline is configured.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I didn't realize that would work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a version with that.


// HasData returns true if the event itself contains data