Compilation dockerbeat


(axil) #1

Hello,
I have a client compilation problem dockerbeat
make

first make sure we have godep

go get github.com/tools/godep
/usr/bin/godep go build

github.com/elastic/beats/libbeat/logp

Godeps/_workspace/src/github.com/elastic/beats/libbeat/logp/log.go:145: undefined: log.LUTC
godep: go exit status 2
make: *** [dockerbeat] Error 1

do you have an idea ?


(Magnus Bäck) #2

Which version of the Go compiler are you using?


(axil) #3

go version
go version go1.3.3 linux/amd64


(Magnus Bäck) #4

log.LUTC was introduced in Go 1.5 (see the release notes) so you need to upgrade your Go compiler.


(axil) #5

ok i migrates "go"
go version
go version go1.5.1 linux/amd64

but I don't know how to add the missing modules

go get github.com/tools/godep
package bufio: unrecognized import path "bufio"
package bytes: unrecognized import path "bytes"
package encoding/json: unrecognized import path "encoding/json"
package errors: unrecognized import path "errors"
package flag: unrecognized import path "flag"
package fmt: unrecognized import path "fmt"
package io/ioutil: unrecognized import path "io/ioutil"
package os: unrecognized import path "os"
package path/filepath: unrecognized import path "path/filepath"
package io: unrecognized import path "io"
package math: unrecognized import path "math"
package log: unrecognized import path "log"
package reflect: unrecognized import path "reflect"
package strconv: unrecognized import path "strconv"
package text/tabwriter: unrecognized import path "text/tabwriter"
package strings: unrecognized import path "strings"
package encoding/xml: unrecognized import path "encoding/xml"
package net/http: unrecognized import path "net/http"
package net/url: unrecognized import path "net/url"
package os/exec: unrecognized import path "os/exec"
package regexp: unrecognized import path "regexp"
package go/ast: unrecognized import path "go/ast"
package go/build: unrecognized import path "go/build"
package go/parser: unrecognized import path "go/parser"
package go/printer: unrecognized import path "go/printer"
package go/token: unrecognized import path "go/token"
package path: unrecognized import path "path"
package runtime: unrecognized import path "runtime"
package runtime/pprof: unrecognized import path "runtime/pprof"
package sort: unrecognized import path "sort"
package text/template: unrecognized import path "text/template"
package unicode: unrecognized import path "unicode"
make: *** [dockerbeat] Error 1
[root@riy10202 dockerbeat-develop]# go version
go version go1.5.1 linux/amd64

how do you offline


(Magnus Bäck) #6

Those packages are part of Go's standard library. Perhaps like your GOPATH or GOROOT environment variable hasn't been properly set up?


(axil) #7

export GOROOT=/usr/lib/golang
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin
make

first make sure we have godep

go get github.com/tools/godep
package bufio: unrecognized import path "bufio"
package bytes: unrecognized import path "bytes"
package encoding/json: unrecognized import path "encoding/json"
package errors: unrecognized import path "errors"
package flag: unrecognized import path "flag"
package fmt: unrecognized import path "fmt"
package io/ioutil: unrecognized import path "io/ioutil"
package os: unrecognized import path "os"
package path/filepath: unrecognized import path "path/filepath"
package io: unrecognized import path "io"
package math: unrecognized import path "math"
package log: unrecognized import path "log"
package reflect: unrecognized import path "reflect"
package strconv: unrecognized import path "strconv"
package text/tabwriter: unrecognized import path "text/tabwriter"
package strings: unrecognized import path "strings"
package encoding/xml: unrecognized import path "encoding/xml"
package net/http: unrecognized import path "net/http"
package net/url: unrecognized import path "net/url"
package os/exec: unrecognized import path "os/exec"
package regexp: unrecognized import path "regexp"
package go/ast: unrecognized import path "go/ast"
package go/build: unrecognized import path "go/build"
package go/parser: unrecognized import path "go/parser"
package go/printer: unrecognized import path "go/printer"
package go/token: unrecognized import path "go/token"
package path: unrecognized import path "path"
package runtime: unrecognized import path "runtime"
package runtime/pprof: unrecognized import path "runtime/pprof"
package sort: unrecognized import path "sort"
package text/template: unrecognized import path "text/template"
package unicode: unrecognized import path "unicode"
make: *** [dockerbeat] Error 1

same thing


(axil) #8

Can you tell me how do you install the missing modules


(Magnus Bäck) #9

I have no idea what's up here. As I said these are standard Go packages that comes with the compiler. You may have better luck asking Go folks about this since it doesn't appear to have anything to do with Dockerbeat.


(Andrew Kroh) #10

You could build it inside of Docker so you don't have to worry about your environment.

$ docker run -it --rm golang:1.5.3 /bin/bash
root@89373aa6f08a:/go# mkdir -p github.com/Ingensi
root@89373aa6f08a:/go/github.com/Ingensi# git clone https://github.com/Ingensi/dockerbeat.git
Cloning into 'dockerbeat'...
remote: Counting objects: 1435, done.
remote: Total 1435 (delta 0), reused 0 (delta 0), pack-reused 1435
Receiving objects: 100% (1435/1435), 1.13 MiB | 0 bytes/s, done.
Resolving deltas: 100% (631/631), done.
Checking connectivity... done.
root@89373aa6f08a:/go/github.com/Ingensi# cd dockerbeat/
root@89373aa6f08a:/go/github.com/Ingensi/dockerbeat# go get -d ./...
root@89373aa6f08a:/go/github.com/Ingensi/dockerbeat# go build
root@89373aa6f08a:/go/github.com/Ingensi/dockerbeat# ./dockerbeat -h

#11

Makefile provide a dockermake target to run dockerbeat compilation into a docker container.

So you should try the make dockermake command


#12

Hi

i did:
docker run -it --rm golang:1.6.2 /bin/bash
mkdir -p github.com/Ingensi
cd github.com/Ingensi
git clone https://github.com/Ingensi/dockerbeat.git
cd dockerbeat/
go get -d ./...

and i got an error:

package golang.org/x/text/cldr: cannot find package "golang.org/x/text/cldr" in any of:
/usr/local/go/src/golang.org/x/text/cldr (from $GOROOT)
/go/src/golang.org/x/text/cldr (from $GOPATH)
package github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts: cannot find package "github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts" in any of:
/usr/local/go/src/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts (from $GOROOT)
/go/src/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/opts (from $GOPATH)
......
......
......

do you have an idea ?


(ruflin) #13

Under Golang 1.6 vendorexperiment is already enabled by default and it seems like dockerbeat is checking in its dependencies, so it seems like you don't need to fetch them. What do you get if you run go build?


#14

root@d80de2d3c999:/go/github.com/Ingensi/dockerbeat# go build

_/go/github.com/Ingensi/dockerbeat
./main.go:12: cannot use beater.New() (type beater.Dockerbeat) as type "github.com/elastic/beats/libbeat/beat".Beater in argument to "github.com/elastic/beats/libbeat/beat".Run:
beater.Dockerbeat does not implement "github.com/elastic/beats/libbeat/beat".Beater (wrong type for Cleanup method)
have Cleanup(
"github.com/ingensi/dockerbeat/vendor/github.com/elastic/beats/libbeat/beat".Beat) error
want Cleanup(
"github.com/elastic/beats/libbeat/beat".Beat) error


#15

I try send data from my dockerserver to logstashserver.

Topbeat, filebeat and packetbeat are running. No problems. But dockerbeat is not easy.

Can you give me any instructions about configuration, please?


(Andrew Kroh) #16

I had no problems building dockerbeat. Make sure you have your Go build environment setup. I was on OSX so I added GOOS=linux to my make command so that the resulting binary is for linux (since I want to run it in a container).

$ echo $GOPATH
/Users/akroh/go
$ mkdir -p $GOPATH/src/github.com/ingensi
$ git clone https://github.com/Ingensi/dockerbeat.git
$ cd $GOPATH/src/github.com/ingensi/dockerbeat
$ GOOS=linux make
$ file dockerbeat
dockerbeat: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped

The configuration options are described in the project's README.


#17

That's great! Thank you.


(system) #18