event

package
v0.0.0-...-08d4bb0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2017 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

An Event is the primary data structure passed around the system. An input creates an Event which is sent to the filter pipeline and eventually out to the output pipeline.

The fields @timestamp, message, type, and tags are protected and should be manipulated using the corresponding Get and Set methods. If any of these fields are manipulated using the generic Get/Set methods, the request will be directed to the correct Get/Set method.

func New

func New(message string) *Event

New creates a new Event object setting its message to message. @timestamp is set to time.Now() and tags and data are empty.

func (*Event) AddTag

func (e *Event) AddTag(tag string)

AddTag will add "tag" to the tags field if the tag doesn't already exist.

func (*Event) Get

func (e *Event) Get(key string) interface{}

Get the value of field key

func (*Event) GetMessage

func (e *Event) GetMessage() string

GetMessage returns the current message.

func (*Event) GetTags

func (e *Event) GetTags() []string

GetTags returns the full tags field.

func (*Event) GetTimestamp

func (e *Event) GetTimestamp() time.Time

GetTimestamp returns the Events canonical timestamp.

func (*Event) GetType

func (e *Event) GetType() string

GetType returns the current Event type.

func (*Event) HasTag

func (e *Event) HasTag(tag string) bool

HasTag returns if "tag" exists in the tags field.

func (*Event) RemoveField

func (e *Event) RemoveField(key string)

RemoveField deletes the field key

func (*Event) RemoveTag

func (e *Event) RemoveTag(tag string)

RemoveTag will delete "tag" from the tags field.

func (*Event) ResetTags

func (e *Event) ResetTags()

ResetTags removes all tags on the Event.

func (*Event) Set

func (e *Event) Set(key string, val interface{})

Set the field key to val.

func (*Event) SetMessage

func (e *Event) SetMessage(s string)

SetMessage sets the Event message to s. Setting the message to an empty string will remove it from output.

func (*Event) SetTags

func (e *Event) SetTags(tags []string)

SetTags will replace the entire tag slice with the given slice.

func (*Event) SetTimestamp

func (e *Event) SetTimestamp(t time.Time)

SetTimestamp sets the Event's canonical timestamp.

func (*Event) SetType

func (e *Event) SetType(val string)

SetType sets the type of the Event. Once type is set, it can't be changed.

func (*Event) Squash

func (e *Event) Squash() *utils.InterfaceMap

Squash reduces the Event to an InterfaceMap where the map keys are the Event's field names. The returned map is safe for the caller to manipulate as it's a copy of the underlying map in the Event. This method is intented for output/codecs modules to encode the Event.

Jump to

Keyboard shortcuts

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