gollum

command module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2015 License: Apache-2.0 Imports: 23 Imported by: 0

README

Gollum

Gollum

GoDoc Documentation Status

Gollum is a n:m multiplexer that gathers messages from different sources and broadcasts them to a set of destinations.

There are a few basic terms used throughout Gollum:

  • "Consumers" read data from other services
  • "Producers" write data to other services
  • "Streams" route data between consumers and producers
  • A "message" is a set of data passed between consumers and producers
  • "Formatters" can transform the content of messages
  • "Filters" can block/pass messages based on their content

Writing a custom plugin does not require you to change any additional code besides your new plugin file.

Consumers (reading data)

  • Console read from stdin.
  • File read from a file (like tail).
  • Http read http requests.
  • Kafka read from a Kafka topic.
  • LoopBack Process routed (e.g. dropped) messages.
  • Proxy use in combination with a proxy producer to enable two-way communication.
  • Socket read from a socket (gollum specfic protocol).
  • Syslogd read from a socket (syslogd protocol).

Producers (writing data)

  • Console write to stdin or stdout.
  • ElasticSearch write to elasticsearch via http/bulk.
  • File write to a file. Supports log rotation and compression.
  • HttpReq HTTP request forwarder.
  • InfluxDB send data to an InfluxDB server.
  • Kafka write to a Kafka topic.
  • Null like /dev/null.
  • Proxy two-way communication proxy for simple protocols.
  • Scribe send messages to a Facebook scribe server.
  • Socket send messages to a socket (gollum specfic protocol).
  • Websocket send messages to a websocket.

Streams (multiplexing)

  • Broadcast send to all producers in a stream.
  • Random send to a random roducers in a stream.
  • RoundRobin switch the producer after each send in a round robin fashion.
  • Route convert streams to one or multiple others

Formatters (modifying data)

  • Base64Encode encodes messages to base64.
  • Base64Decode decodes messages from base64.
  • CollectdToInflux converts CollectD data to InfluxDB compatible values.
  • Envelope add a prefix and/or postfix string to a message.
  • Forward write the message without modifying it.
  • Hostname prepends the current machine's hostname to a message.
  • Identifier hashes the message to generate a (mostly) unique id.
  • JSON write the message as a JSON object. Messages can be parsed to generate fields.
  • Runlength prepends the length of the message.
  • Sequence prepends the sequence number of the message.
  • StreamName prepend the name of a stream to the payload.
  • StreamRevert route a message to the previous stream (e.g. after it has been routed).
  • StreamRoute route a message to another stream by reading a prefix.
  • Timestamp prepends a timestamp to the message.

Filters (filtering data)

  • All lets all message pass.
  • Json blocks or lets json messages pass based on their content.
  • None blocks all messages.
  • RegExp blocks or lets messages pass based on a regular expression.
  • Stream blocks or lets messages pass based on their stream name.

Installation

From source

Installation from source requires the installation of the Go toolchain.
Gollum has Godeps support but this is considered optional.

$ go get .
$ go build
$ gollum --help

You can use the supplied make file to trigger cross platform builds.
Make will produce ready to deploy .tar.gz files with the corresponding platform builds.
This does require a cross platform golang build.
Valid make targets (besides all and clean) are:

  • freebsd
  • linux
  • mac
  • pi
  • win

Usage

To test gollum you can make a local profiler run with a predefined configuration:

$ gollum -c config/profile.conf -ps -ll 3

By default this test profiles the theoretic maximum throughput of 256 Byte messages.
You can enable different producers to test the write performance of these producers, too.

Configuration

Configuration files are written in the YAML format and have to be loaded via command line switch. Each plugin has a different set of configuration options which are currently described in the plugin itself, i.e. you can find examples in the GoDocs.

Commandline

-c or --config [file]

Use a given configuration file.

-h or --help

Print this help message.

-ll or --loglevel [0-3]

Set the loglevel [0-3]. Higher levels produce more messages.

-m or --metrics [port]

Port to use for metric queries. Set 0 to disable.

-n or --numcpu [number]

Number of CPUs to use. Set 0 for all CPUs.

-p or --pidfile [file]

Write the process id into a given file.

-pc or --profilecpu [file]

Write CPU profiler results to a given file.

-pm or --profilemem [file]

Write heap profile results to a given file.

-ps or --profilespeed

Write msg/sec measurements to log.

-tc or --testconfig [file]

Test a given configuration file and exit.

-v or --version

Print version information and quit.

Building

Mac OS X

The easiest way to install go is by using homebrew:
brew install go

If you want to do cross platform builds you need to specify an additional option (Go 1.5 does not require this anymore):
brew install go --with-cc-all

Linux

Download Go from the golang website and unzip it to e.g. /usr/local/go.
You have to set the GOROOT environment variable to the folder you chose:
export GOROOT=/usr/local/go

Prerequisites

If you do not already have a GOPATH set up you need to create one.
The location is free of choice, we prefer to put it into each users home folder:

mkdir -p ~/go
export GOROOT=$(HOME)/go

You can download gollum via go get github.com/trivago/gollum or clone it directly into your GOPATH.
If you choose this way you need to download your dependencies directly from that folder

mkdir -p $(GOPATH)/src/github.com/trivago
cd $(GOPATH)/src/github.com/trivago
git clone https://github.com/trivago/gollum.git
cd gollum
go get -u .

Build

Building gollum is as easy as go build.
If you want to do cross platform builds use make all or specifiy one of the following platforms instead of "all":

  • freebsd
  • linux
  • mac
  • pi
  • win

Please not that building for windows will give you errors, which can be solved by removing the lines reported.
If you want to use native plugins (contrib/native) you will have to enable the import in the file contrib/loader.go. Doing so will disable the possibility to do cross-platform builds for most users.

Dockerfile

The repository contains a Dockerfile which enables you to build and run gollum inside a Docker container.

$ docker build -t trivago/gollum .
$ docker run -it --rm trivago/gollum -c config/profile.conf -ps -ll 3

To use your own configuration you could run:

$ docker run -it --rm -v /path/to/config.conf:/etc/gollum/gollum.conf:ro trivago/gollum -c /etc/gollum/gollum.conf

Solving dependency problems

If you got any errors during build regarding external dependencies (i.e. the error message points to another repository than github.com/trivago) you can restore the last dependency snapshot using godep. Install godep via go get github.com/tools/godep and restore the dependency via godep restore when inside the gollum base folder.

License

This project is released under the terms of the Apache 2.0 license.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/bitly/go-hostpool
A Go package to intelligently and flexibly pool among multiple hosts from your Go application.
A Go package to intelligently and flexibly pool among multiple hosts from your Go application.
_workspace/src/github.com/eapache/go-resiliency/breaker
Package breaker implements the circuit-breaker resiliency pattern for Go.
Package breaker implements the circuit-breaker resiliency pattern for Go.
_workspace/src/github.com/eapache/queue
Package queue provides a fast, ring-buffer queue based on the version suggested by Dariusz Górecki.
Package queue provides a fast, ring-buffer queue based on the version suggested by Dariusz Górecki.
_workspace/src/github.com/golang/protobuf/proto
Package proto converts data structures to and from the wire format of protocol buffers.
Package proto converts data structures to and from the wire format of protocol buffers.
_workspace/src/github.com/golang/protobuf/proto/proto3_proto
Package proto3_proto is a generated protocol buffer package.
Package proto3_proto is a generated protocol buffer package.
_workspace/src/github.com/golang/snappy
Package snappy implements the snappy block-based compression format.
Package snappy implements the snappy block-based compression format.
_workspace/src/github.com/miekg/pcap
Package pcap is a wrapper around the pcap library.
Package pcap is a wrapper around the pcap library.
_workspace/src/github.com/shopify/sarama
Package sarama provides client libraries for the Kafka 0.8 protocol.
Package sarama provides client libraries for the Kafka 0.8 protocol.
_workspace/src/github.com/shopify/sarama/mocks
Package mocks provides mocks that can be used for testing applications that use Sarama.
Package mocks provides mocks that can be used for testing applications that use Sarama.
_workspace/src/golang.org/x/net/websocket
Package websocket implements a client and server for the WebSocket protocol as specified in RFC 6455.
Package websocket implements a client and server for the WebSocket protocol as specified in RFC 6455.
_workspace/src/gopkg.in/Shopify/sarama.v1
Package sarama provides client libraries for the Kafka 0.8 protocol.
Package sarama provides client libraries for the Kafka 0.8 protocol.
_workspace/src/gopkg.in/Shopify/sarama.v1/mocks
Package mocks provides mocks that can be used for testing applications that use Sarama.
Package mocks provides mocks that can be used for testing applications that use Sarama.
_workspace/src/gopkg.in/bufio.v1
Package bufio implements buffered I/O. It wraps an io.Reader or io.Writer object, creating another object (Reader or Writer) that also implements the interface but provides buffering and some help for textual I/O.
Package bufio implements buffered I/O. It wraps an io.Reader or io.Writer object, creating another object (Reader or Writer) that also implements the interface but provides buffering and some help for textual I/O.
_workspace/src/gopkg.in/docker/docker.v1/pkg/mflag
Package flag implements command-line flag parsing.
Package flag implements command-line flag parsing.
_workspace/src/gopkg.in/mcuadros/go-syslog.v2
Syslog server library for go, build easy your custom syslog server over UDP, TCP or Unix sockets using RFC3164 or RFC5424
Syslog server library for go, build easy your custom syslog server over UDP, TCP or Unix sockets using RFC3164 or RFC5424
_workspace/src/gopkg.in/redis.v2
Package redis implements a Redis client.
Package redis implements a Redis client.
_workspace/src/gopkg.in/yaml.v2
Package yaml implements YAML support for the Go language.
Package yaml implements YAML support for the Go language.
Package core is a generated protocol buffer package.
Package core is a generated protocol buffer package.
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL