# Building custom filebeat debian

**URL:** <https://discuss.elastic.co/t/building-custom-filebeat-debian/71163>\
**Category:** Beats\
**Created:** [January 11, 2017, 12:29am UTC](https://discuss.elastic.co/t/building-custom-filebeat-debian/71163 "2017-01-11T00:29:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![surajs](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@surajs](https://discuss.elastic.co/u/surajs)\
**Post date:** [January 11, 2017, 12:29am UTC](https://discuss.elastic.co/t/building-custom-filebeat-debian/71163/1 "2017-01-11T00:29:03Z")

</div>

So i've been following [How to create a new Beats output?](https://discuss.elastic.co/t/how-to-create-a-new-beats-output/61074/3) 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?

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [January 11, 2017, 12:44pm UTC](https://discuss.elastic.co/t/building-custom-filebeat-debian/71163/2 "2017-01-11T12:44:08Z")

</div>

> 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`.

---

<div class="post-metadata">

**Author:** ![surajs](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@surajs](https://discuss.elastic.co/u/surajs)\
**Post date:** [January 11, 2017, 1:41pm UTC](https://discuss.elastic.co/t/building-custom-filebeat-debian/71163/3 "2017-01-11T13:41:24Z")

</div>

@steffens,

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

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [January 11, 2017, 3:27pm UTC](https://discuss.elastic.co/t/building-custom-filebeat-debian/71163/4 "2017-01-11T15:27:49Z")

</div>

The beats have a `make package` target ([See](https://github.com/elastic/beats/blob/master/libbeat/scripts/Makefile#L393) and [packer tool](https://github.com/elastic/beats/tree/master/dev-tools/packer)). It's using xgo for cross compiling and [fpm](https://github.com/jordansissel/fpm) to build the actual deb/rpm packages.

The filebeat [Makefile](https://github.com/elastic/beats/blob/master/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](https://github.com/Debian/dh-make-golang).

---

<div class="post-metadata">

**Author:** ![surajs](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@surajs](https://discuss.elastic.co/u/surajs)\
**Post date:** [January 13, 2017, 1:16am UTC](https://discuss.elastic.co/t/building-custom-filebeat-debian/71163/5 "2017-01-13T01:16:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [January 13, 2017, 1:10pm UTC](https://discuss.elastic.co/t/building-custom-filebeat-debian/71163/6 "2017-01-13T13:10:48Z")

</div>

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](https://github.com/elastic/beats/pull/3339) I still need to investigate the gotpl issue.

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [January 16, 2017, 2:18pm UTC](https://discuss.elastic.co/t/building-custom-filebeat-debian/71163/7 "2017-01-16T14:18:29Z")

</div>

@surajs Here is a similar issue with gotpl: What OS are you on? [Make package: yaml.v2': No such file or directory](https://discuss.elastic.co/t/make-package-yaml-v2-no-such-file-or-directory/66357/27) Did you get the same error as in this thread?

---

<div class="post-metadata">

**Author:** ![surajs](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@surajs](https://discuss.elastic.co/u/surajs)\
**Post date:** [January 24, 2017, 1:03am UTC](https://discuss.elastic.co/t/building-custom-filebeat-debian/71163/8 "2017-01-24T01:03:21Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 1, 2017, 12:29am UTC](https://discuss.elastic.co/t/building-custom-filebeat-debian/71163/9 "2017-02-01T00:29:03Z")

</div>

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