Generating Your Beat
editGenerating Your Beat
editTo 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 python and specify the path to the Beat generator:
Python 2 is required (Python 3 will not work).
python $GOPATH/src/github.com/elastic/beats/script/generate.py
Python 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.
Beat Name [Examplebeat]: Countbeat Your Github Name [your-github-name]: {username} Beat Path [github.com/{github id}/{beat name}]: Firstname Lastname: {Full Name}
The Beat generator creates a directory called countbeat
inside of your project folder (e.g. {project folder}/github.com/{github id}/countbeat).
You now have a raw template of the Beat, but you still need to fetch dependencies and set up the Beat.