How to create a new Beats output?

There is no need to clone or copy filebeat. See my post from 7 days ago.

You might have 2 repositories for example:

  1. github.com/ageetha/logmet holding the new output plugin
  2. github.com/ageetha/filebeat-logmet holding your custom filebeat with logmet being included.

In github.com/ageetha/filebeat-logmet you have only one file named main.go with content:

import (
    "os"

    _ "github.com/ageetha/logmet"

    "github.com/elastic/beats/filebeat/beater"
    "github.com/elastic/beats/libbeat/beat"
)

Name := "filebeat-logmet"

func main() {
    if err := beat.Run(Name, "", beater.New()); err != nil {
        os.Exit(1)
    }
}

No run go build in $GOPATH/src/github.com/ageetha/filebeat-logmet directory and you will get your filebeat binary. Advantage of this solution is, you can more easily upgrade to new filebeat just by checking another branch from filebeat. Updating to filebeat 5.0 will require you to change main.go to:

import (
    "os"

        _ "github.com/myuser/mybeatsoutputs/myoutput"

    "github.com/elastic/beats/filebeat/beater"
    "github.com/elastic/beats/libbeat/beat"
)

func main() {
    if err := beat.Run("myfilebeat, "", beater.New); err != nil {
        os.Exit(1)
    }
}

Beats are made this way, to reduce the amount of maintenance normally required when copying and modifying some other projects source code.