Getting Ready

edit

All Beats are written in Go, so having Go installed and knowing the basics are prerequisites for understanding this guide. But don’t worry if you aren’t a Go expert. Go is a relatively new language, and very few people are experts in it. In fact, several people learned Go by contributing to Packetbeat and libbeat, including the original Packetbeat authors.

For general information about contributing to Beats, see Contributing to Beats.

After you have installed Go and set up the GOPATH environment variable to point to your preferred workspace location, a simple way of getting the source code for Beats, including libbeat and the Beat generator, is to do:

go get github.com/elastic/beats

When you run the command, all source files are downloaded to the $GOPATH/src/github.com/elastic/beats path. You can ignore the "no buildable Go source files" message because you will build the source later. By default go get fetches the master branch. To build your beat on a specific version of libbeat, check out the specific branch (6.1 in the example below):

cd ${GOPATH}/src/github.com/elastic/beats
git checkout 6.1

If you have multiple go paths, use ${GOPATH%%:*} instead of ${GOPATH}.