Building custom filebeat debian


(Suraj) #1

So i've been following How to create a new Beats output? to create a custom beats output.

So now i have two repositories as discussed in the post :

  1. filebeat
  2. custom-output

I now need to create a debian for the "custom" filebeat that i have. What is the right approach for creating that one?


(Steffen Siering) #2

I now need to create a debian for the "custom" filebeat that i have. What is the right approach for creating that one?

What you mean by create a debian? Just build your custom beat with go build.


(Suraj) #3

@steffens,

I meant i need to package it as a debian package.


(Steffen Siering) #4

The beats have a make package target (See and packer tool). It's using xgo for cross compiling and fpm to build the actual deb/rpm packages.

The filebeat Makefile includes the Makefile providing packer and sets some environment variables.

If you have a very custom main.go, this might be some overkill though. If all you need is a debian package you can also check out dh-make-golang.


(Suraj) #5

Thanks @steffen for the pointers.

I basically imported the filebeat Makefile to the filebeat repo and added the following to build the debian package I needed.

BEAT_DIR=com.abc.xyz/filebeat
ES_BEATS=./vendor/github.com/elastic/beats
GOPACKAGES=$(shell glide novendor)
SNAPSHOT=no
include $(ES_BEATS)/libbeat/scripts/Makefile

However, for some reason, i had to comment out the following in libbeat/before_build.sh file

# Install gotpl. Clone and copy needed as go-yaml is behind a proxy which doesn't work
# with git 1.7
#git clone https://github.com/tsg/gotpl.git /go/src/github.com/tsg/gotpl
#mkdir -p /go/src/gopkg.in/yaml.v2
#cp -r /go/src/github.com/elastic/beats/vendor/gopkg.in/yaml.v2 /go/src/gopkg.in/
#go install github.com/tsg/gotpl

and had to install gotpl manually to get it working.


Make package: yaml.v2': No such file or directory
(ruflin) #6

Be aware that you have to rename BEAT_DIR to BEAT_PATH as soon as this one is merged: https://github.com/elastic/beats/pull/3339 I still need to investigate the gotpl issue.


(ruflin) #7

@surajs Here is a similar issue with gotpl: What OS are you on? Make package: yaml.v2': No such file or directory Did you get the same error as in this thread?


(Suraj) #8

@ruflin,

Yes, had got similar error as the other thread. And the OS configuration was :

PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian

I see that you have PR merged to fix this. Will verify and reach out in case I find any issues.


(system) #9

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