This is a short guide to get up and building Elastic Beats on a new Linux host.
This uses Google Compute Engine (GCE) to start an Ubuntu 20.04 virtual machine. You can use other versions of Linux or different virtualization platforms (or no virtualization), but those are not guaranteed to work with the commands here.
gcloud auth login
gcloud config set project elastic-beats
gcloud compute instances create $USER-beats-dev \
--image-project=ubuntu-os-cloud \
--image-family ubuntu-2004-lts \
--zone us-central1-a \
--machine-type=n1-standard-1 \
--boot-disk-size=100GB
gcloud compute ssh --zone=us-central1-a $USER-beats-dev
NOTE: To clean up this resource afterwards use gcloud compute instances delete --zone us-central1-a $USER-beats-dev
.
sudo apt-get update
sudo apt-get install -y vim docker.io make gcc python3-pip python3-venv git libpcap-dev libsystemd-dev librpm-dev
sudo curl -L "https://github.com/andrewkroh/gvm/releases/download/v0.4.1/gvm-linux-amd64" -o /usr/local/bin/gvm
sudo chmod +x /usr/local/bin/gvm
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo usermod -a -G docker $USER
mkdir -p ~/go/src/github.com/elastic
git clone https://github.com/elastic/beats.git ~/go/src/github.com/elastic/beats
This configures your bash shell to setup your Go development envionrment on login.
echo 'eval "$(gvm $(cat ~/go/src/github.com/elastic/beats/.go-version))"' >> ~/.bash_aliases
echo 'export PATH=$(go env GOPATH)/bin:${PATH}' >> ~/.bash_aliases
source ~/.bash_aliases
cd ~/go/src/github.com/elastic/beats
make mage
The main build tool is Mage. You can use mage -l
to list
the available build targets. And mage -h <target>
to get detailed usage information
about a target.
cd filebeat # or any Beat
mage -l
mage -h exportDashboard
mage update
You can use mage -v <targets>
to enable verbose output from Mage.
mage build
mage unitTest
mage integTest
If you are going to execute multiple targets it's more efficient to run them in a single command.
mage update build integTest
mage package
You can control the target platforms with the PLATFORMS
environment variable. Use SNAPSHOT=true
to build a snapshot. And use VERSION_QUALIFIER=rc1
to add a qualifier to version. Some examples:
PLATFORMS='linux/amd64' SNAPSHOT=true mage package
PLATFORMS='linux/armv7' mage package
PLATFORMS='windows darwin' mage package
Packages are written to build/distributions
.
Hello, this is an excellent tutorial.
When running this per the instructions, I received only filebeat-oss-8.2.0-SNAPSHOT-amd64.X file outputs and the process ended with the following output.
and
Questions:
Thank you - Jared