event

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterMeta

func RegisterMeta(m *AgentMeta)

func Save

func Save(event *Event) error

func SaveLog

func SaveLog(event *Event) error

func SaveWithTimestamp

func SaveWithTimestamp(event *Event, time2 time.Time) error

func UpdateAgentID

func UpdateAgentID(agentID string)

Types

type Activity

type Activity struct {
	ID        string           `json:"id,omitempty"      elastic_meta:"_id" elastic_mapping:"id: { type: keyword }"`
	Timestamp time.Time        `json:"timestamp,omitempty" elastic_mapping:"timestamp:{type: date }"`
	Metadata  ActivityMetadata `json:"metadata" elastic_mapping:"metadata: { type: object }"`
	Changelog interface{}      `json:"changelog,omitempty" elastic_mapping:"changelog:{type: object,enabled:false }"`
	Fields    util.MapStr      `json:"payload" elastic_mapping:"payload:{type: object,enabled:false }"`
}

type ActivityMetadata

type ActivityMetadata struct {
	Labels   util.MapStr `json:"labels,omitempty"  elastic_mapping:"labels:{type: object }"`
	Category string      `json:"category,omitempty"`
	Group    string      `json:"group,omitempty"`
	Name     string      `json:"name,omitempty"`
	Type     string      `json:"type,omitempty"`
	User     util.MapStr `json:"user,omitempty"`
}

type AgentMeta

type AgentMeta struct {
	DefaultMetricQueueName string `json:"-"`
	LoggingQueueName       string `json:"-"`

	AgentID  string   `json:"id,omitempty"`
	HostID   string   `json:"host_id,omitempty"`
	Hostname string   `json:"hostname,omitempty"`
	MajorIP  string   `json:"major_ip,omitempty"`
	IP       []string `json:"ips,omitempty"`

	Tags   []string          `json:"tags,omitempty"`
	Labels map[string]string `json:"labels,omitempty"`
}

type Event

type Event struct {
	Agent *AgentMeta `json:"agent"`

	QueueName string `json:"-"`

	Timestamp time.Time     `json:"timestamp,omitempty" elastic_mapping:"timestamp: { type: date }"`
	Metadata  EventMetadata `json:"metadata"`
	Fields    util.MapStr   `json:"payload"`

	Meta       util.MapStr `json:"-"`
	Private    interface{} `json:"-"` // for beats private use
	TimeSeries bool        `json:"-"` // true if the event contains timeseries data
}

func (*Event) Delete

func (e *Event) Delete(key string) error

func (*Event) GetValue

func (e *Event) GetValue(key string) (interface{}, error)

func (*Event) PutValue

func (e *Event) PutValue(key string, v interface{}) (interface{}, error)

func (*Event) SetErrorWithOption

func (e *Event) SetErrorWithOption(jsonErr util.MapStr, addErrKey bool)

SetErrorWithOption sets jsonErr value in the event fields according to addErrKey value.

func (*Event) SetID

func (e *Event) SetID(id string)

SetID overwrites the "id" field in the events metadata. If Meta is nil, a new Meta dictionary is created.

func (*Event) String

func (e *Event) String() string

type EventMetadata

type EventMetadata struct {
	Labels   util.MapStr `json:"labels,omitempty"`
	Category string      `json:"category,omitempty"`
	Name     string      `json:"name,omitempty"`
	Version  string      `json:"version,omitempty"`
	Datatype string      `json:"datatype,omitempty"`
}

Jump to

Keyboard shortcuts

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