logger

package module
v0.0.0-...-13aae7d Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PayloadsChannelSize = 1000
	// in seconds, how often batched events should be sent
	SendFrequency = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SplunkEvent

type SplunkEvent struct {
	Message string `json:"message"`
	Ident   string `json:"ident"`
	Host    string `json:"host"`
}

type SplunkHook

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

func NewSplunkHook

func NewSplunkHook(context context.Context, host, port, token, source string) (*SplunkHook, error)

func (*SplunkHook) Fire

func (sh *SplunkHook) Fire(entry *logrus.Entry) error

func (*SplunkHook) Levels

func (sh *SplunkHook) Levels() []logrus.Level

type SplunkLogger

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

func NewSplunkLogger

func NewSplunkLogger(context context.Context, url, token, source, hostname string) *SplunkLogger

func (*SplunkLogger) LogWithTime

func (sl *SplunkLogger) LogWithTime(t time.Time, msg string) error

func (*SplunkLogger) SendPayloads

func (sl *SplunkLogger) SendPayloads(payloads []*SplunkPayload) error

type SplunkPayload

type SplunkPayload struct {
	// splunk expects unix time in seconds
	Time  int64       `json:"time"`
	Host  string      `json:"host"`
	Event SplunkEvent `json:"event"`
}

Jump to

Keyboard shortcuts

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