logstash

package
v1.0.0-beta.8 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BufferFull    dropReason = "buffer_full"
	FailedToWrite dropReason = "failed_to_write"
	BadFormat     dropReason = "bad_format"
)

Variables

View Source
var (
	TimestampFormat string = defaultTimestampFormat
)

Functions

func NewFormatter

func NewFormatter() (*logstashFormatter, error)

Types

type Hook

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

Hook sends logs to Logstash.

func NewHook

func NewHook(hostPort string, formatter logrus.Formatter) (*Hook, error)

newHook creates a hook to be added to an instance of logger. It connects to Logstash on host via TCP.

func (*Hook) Fire

func (hook *Hook) Fire(entry *logrus.Entry) error

Fire implements the Fire method from the Hook interface. It writes to its local buffer for the Entry to be sent off asynchronously. If the buffer is full, it will drop the entry.

func (Hook) Levels

func (hook Hook) Levels() []logrus.Level

Levels returns all logrus levels.

type ReconnectingWriter

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

ReconnectingWriter wraps a net.Conn such that it will never fail to write and will attempted to reestablish the connection whenever an error occurs.

func NewReconnectingWriter

func NewReconnectingWriter(dial dialFunc, errLogger logrus.FieldLogger) *ReconnectingWriter

func (*ReconnectingWriter) Write

func (c *ReconnectingWriter) Write(b []byte) (int, error)

Write will run the following retry all of the following in a loop until it manages one successful write: * attempt to re-establish a connection if a connection is not available * attempt to write the given bytes if a connection is available and exit if it succeeds * reset the underlying connection if write fails

Deadline is set for all writes as specified in the flag.

Jump to

Keyboard shortcuts

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