logstash

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessMods

func ProcessMods(json string, adds, copies, moves map[string]string) (string, error)

ProcessMods applies adds, renames, and moves to a JSON string

Types

type Logstash

type Logstash struct {
	Connection *net.TCPConn
	Timeout    int    //Timeout in seconds
	Host       string // Host in host:port format
	// contains filtered or unexported fields
}

Logstash is the basic struct

func NewHost

func NewHost(host string, timeout int) (*Logstash, error)

NewHost generates a logstash sender from a host:port format

func (*Logstash) Close

func (ls *Logstash) Close() error

Close the underlying TCP connection

func (*Logstash) Connect

func (ls *Logstash) Connect() (*net.TCPConn, error)

Connect to the host

func (*Logstash) Writeln

func (ls *Logstash) Writeln(message string) error

Writeln send a message to the host

type Record

type Record map[string]interface{}

Record holds the parent struct of what we will send to logstash

func NewRecord

func NewRecord() Record

NewRecord initializes a new record

func (*Record) Copy

func (r *Record) Copy(srckey, newkey string)

Copy value from srckey to newkey

func (*Record) Move

func (r *Record) Move(oldkey, newkey string)

Move old key to new key

func (*Record) Set

func (r *Record) Set(key string, value interface{})

Set assigns a string value to a key in the event

func (*Record) SetIfEmpty

func (r *Record) SetIfEmpty(key string, value interface{})

SetIfEmpty sets a value if one doesn't already exist

func (*Record) ToJSON

func (r *Record) ToJSON() (string, error)

ToJSON marshalls to a string

func (*Record) ToJSONBytes

func (r *Record) ToJSONBytes() ([]byte, error)

ToJSONBytes marshalls to a byte array

type Severity

type Severity int

Severity is the severity for a record

const (
	// Error event
	Error Severity = 3
	// Warning event
	Warning Severity = 4
	// Info event
	Info Severity = 6
)

func (Severity) String

func (s Severity) String() string

Jump to

Keyboard shortcuts

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