File Beat for Raspberry Pi?

Compiling Filebeat for ARM

Jonathan Homer

2 minute read

I have a small raspberry PI that runs my workshop heating. It would be nice for it to push its log onto Elastic Search. With Raspberry Pi’s doing things like IOT and perhaps small duties such as Remote Display Boards the need for logging is important. Especially if you have a few that you want to monitor to see if anyone is trying to muck around with them. Anyhow I downloaded filebeat installed it and it failed. Obviously really. Not compiled for ARM. I thought not problem download the ARM version. Couldn’t find the versions.

However I did find instructions from Andrew Kroh on the elastic.co website. Which were great but now out of date. So here is his work updated to the latest version for those who wish to do this.

Important note. You do need docker installed. There are plenty of guides how to do that, so do that the first if you need to.

First create a directory for the code to live.

mkdir filebeat-arm-bin && cd filebeat-arm-bin

Run Docker to create a little GO environment. We have chosen version 1.13. Remember these are lively and well updated languages. You may find you need to bump the version to a later version.

sudo docker run -it --rm -v `pwd`:/build golang:1.13 /bin/bash

Now you are inside a Go environment. The next command gets the source code for elastic beats. Then we move into the source directory that we have pulled.

go get github.com/elastic/beats
cd /go/src/github.com/elastic/beats/filebeat/

We need to checkout a version. This allows us to choose the exact version we want. Top tip. Never the latest (as it could still be buggy) but don’t hang around with an old one either!

So change the below if you want a different version.

git checkout v6.8.12

We ask Go for the ARM version and ask it to build the code for us.

GOARCH=arm go build

It won’t take long. Next step is to copy the output to the volume we are running an environment so we can get the output.

cp filebeat /build

We are now done just run exit.

So you now have compiled a code for a different platform on your machine. Docker takes most of the heavy work out of it!

comments powered by Disqus