logstash

package module
v0.0.0-...-8a6c391 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

README

logspout-logstash

CircleCI Coverage Status

A minimalistic adapter for github.com/gliderlabs/logspout to write to Logstash TCP. Supports

  • multi-line log grouping
  • udacity metadata

Log lines identified as JSON preserve the app-specific fields when shipped to Logstash.

Follow the instructions in https://github.com/gliderlabs/logspout/tree/master/custom on how to build your own Logspout container with custom modules. Basically just copy the contents of the custom folder and include:

import (
  _ "github.com/udacity/logspout-logstash"
  _ "github.com/gliderlabs/logspout/transports/udp"
)

in modules.go.

Use by setting ROUTE_URIS=logstash://host:port to the Logstash host and port for TCP.

In your logstash config, set the input codec to json e.g:

input {
  tcp {
    port => 5000
    codec => json
  }
}

Developing

### See Makefile
### All build artifacts have make-style dependencies defined

# install build dependencies
make deps

# test
make test

# view coverage report in your browser
make view-coverage

# submit a coveralls report
# must configure COVERALLS_TOKEN env var, should be run from CI only
make coveralls

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogstashAdapter

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

NewLogstashAdapter creates a LogstashAdapter with TCP as the default transport.

Types

type ComponentInfo

type ComponentInfo struct {
	Name    string `json:"name"`
	Env     string `json:"env"`
	Version string `json:"version"`
}

type ControlCode

type ControlCode int
const (
	Continue ControlCode = iota
	Quit
)

type DockerInfo

type DockerInfo struct {
	Name     string `json:"name"`
	ID       string `json:"id"`
	Image    string `json:"image"`
	Hostname string `json:"hostname"`
}

type JavaException

type JavaException struct {
	CauseException string `json:"causeEx"`
	CauseMessage   string `json:"causeMsg"`
	FullClass      string `json:"fullclass"`
	Method         string `json:"method"`
	ClassLine      string `json:"classline"`
	Jar            string `json:"jar"`
}

type JavaLog

type JavaLog struct {
	Timestamp string         `json:"timestamp"`
	Level     string         `json:"level"`
	Uuid      string         `json:"uuid"`
	Thread    string         `json:"thread"`
	Logger    string         `json:"logger"`
	Exception *JavaException `json:"exception,omitempty"`
}

type LogstashAdapter

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

LogstashAdapter is an adapter that streams TCP JSON to Logstash.

func (*LogstashAdapter) Stream

func (a *LogstashAdapter) Stream(logstream chan *router.Message)

Stream implements the router.LogAdapter interface.

type LogstashMessage

type LogstashMessage struct {
	Message   string        `json:"message"`
	Stream    string        `json:"stream"`
	Docker    DockerInfo    `json:"docker"`
	Component ComponentInfo `json:"component"`
	JavaLog   *JavaLog      `json:"javaLog,omitempty"`
}

LogstashMessage is a simple JSON input to Logstash.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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