New To Beats : Unable to build custom beat for cross-environment

I was able to create a sample beat using developer guide (kudos to it). However when i make a beat in Mac am unable to run it on a linux x86 box. I provided "GOOS=linux GOARCH=386" in Makefile and then ran make. However the executable is not working in linux environment.

I see cannot execute binary file: Exec format error error when i run beat.

My machine is
uname -a
Linux 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

And i tried following options
#GOPACKAGES=$(shell glide novendor)

Appreciate your time.

Hi Deepak,

I ran a similar test with a community beat I wrote and it worked:

openconfigbeat $ GOOS=linux GOARCH=amd64 make
go build
openconfigbeat $ docker run -ti -v `pwd`:/openconfigbeat ubuntu /openconfigbeat/openconfigbeat
openconfigbeat2017/03/15 21:46:17.114039 beat.go:369: CRIT Exiting: error loading config file: stat openconfigbeat.yml: no such file or directory
Exiting: error loading config file: stat openconfigbeat.yml: no such file or directory

For your reference the Makefile in this case looks like this:

Hello Valente,
Thanks for your time. I do not see GOOS and GOARCH options in makefile. When i put GOOS=linux
GOARCH=amd64 in makefile and run make, the executable was not built for linux but for Mac (my local machine).

How do change Makefile so that the executable built is for linux amd64 ?
Also, do i need to copy the configuration files (*.yml) by myself to destination machine ?
Generic question would be how is a beat packaged ?


GOOS and GOARCH are not there because if you pass them to your make command they just propagate to go build via libbeat/scripts/Makefile (see the related include statement in my Makefile). You do need to copy the .yml files in addition to your beat's binary.

My assumption was all settings goes into Makefile. I was incorrect.


This topic was automatically closed after 21 days. New replies are no longer allowed.