raw

package module
v0.0.0-...-991b98d Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2017 License: MIT Imports: 8 Imported by: 0

README

logspout-firehose

Logspout adapter for writing Docker container logs to AWS Kinesis Firehose

Deploy

Build a logspout image with this firehose adapter (see Build section below).

Then run using whatever docker launch method you prefer. The important things to note are the AWS config ENV vars, the volume mount for docker socket, and the firehose launch command.

$ docker run --name="logspout" \
    --volume=/var/run/docker.sock:/var/run/docker.sock \
    -e AWS_ACCESS_KEY_ID=... \
    -e AWS_REGION=us-east-1 \
    -e AWS_SECRET_ACCESS_KEY=... \
    your-logspout-image \
    firehose://delivery-stream-name

See the logspout docs for more launch options.

Build

To use, you must build a container image of logspout which contains the firehose adapter.

The easiest way to do this reliably is to fork the official logspout repo and add this this repo to the modules.go file.

Then docker build . -t <your-image-tag> in your forked logspout repo.

I find this approach to work best as it ensures you use a known version of logspout as the base.

Side note: GO dependencies and imports are idiotic constructs so if your fork of logspout breaks later because it is trying to download incompatible versions of dependencies via go get just blame the stupidity of GO.

Development

Similar to the above Build process except you should use the Dockerfile.dev in the logspout repo (if it still exists) to build your base logspout image.

In your logspout repo clone/fork.

docker build -t logspout -f Dockerfile.dev .`

Then use the dev.sh script in this repo to launch a container with a shell where you will build and run logspout as you iterate.

In the container, run the following as you make changes.

go build -ldflags "-X main.Version=dev" -o /bin/logspout
/bin/logspout firehose://stream-name

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRawAdapter

func NewRawAdapter(route *router.Route) (router.LogAdapter, error)

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

func (*Adapter) Stream

func (adapter *Adapter) Stream(logstream chan *router.Message)

type Record

type Record struct {
	Timestamp     time.Time              `json:"@timestamp"`
	ContainerId   string                 `json:"container_id"`
	ContainerName string                 `json:"container_name"`
	Message       string                 `json:"message"`
	Hostname      string                 `json:"hostname"`
	Source        string                 `json:"source"` // stdout, stderr
	Args          map[string]interface{} `json:"args,omitempty"`
}

Jump to

Keyboard shortcuts

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