Generating Your Beat

edit

To generate your own Beat, you use the Beat generator available in the beats repo on GitHub. If you haven’t downloaded the Beats source code yet, follow the instructions in Setting Up Your Dev Environment.

Before running the Beat generator, you must decide on a name for your Beat. The name should be one word with the first letter capitalized. In our example, we use Countbeat.

Now create a directory under $GOPATH for your repository and change to the new directory:

mkdir ${GOPATH}/src/github.com/{user}
cd ${GOPATH}/src/github.com/{user}

Run the mage script to generate the custom beat:

mage GenerateCustomBeat

The mage script will prompt you to enter information about your Beat. For the project_name, enter Countbeat. For the github_name, enter your github id. The beat and beat_path are set to the correct values automatically (just press Enter to accept each default). For the full_name, enter your firstname and lastname. Finally, pick the revision of elastic/beats you would like to depend on.

Enter a project name [examplebeat]:  Countbeat
Enter a github name [your-github-name]: {username}
Enter a beat path [github.com/{username}/countbeat]:
Enter a full name [Firstname Lastname]: {Full Name}
Enter the github.com/elastic/beats revision [master]:

The Beat generator creates a directory called countbeat inside of your project folder (e.g. {project folder}/github.com/{github id}/countbeat).

Please note that it is not possible to use revisions of Beats which does not support go modules.

You now have a raw template of the Beat, but you still need to fetch dependencies and set up the Beat.