logrussplunk

package
v0.0.0-...-5720ada Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package logrussplunk allows hooking into logrus such that all logs will go to splunk via the Splunk HTTP Event Collector (HEC).

Index

Constants

This section is empty.

Variables

View Source
var ErrEventsBufferOverflow = errors.New("events buffer overflow")

ErrEventsBufferOverflow is returned by `Fire` if the we log and event but have yet to process all previous events.

View Source
var ErrMissingSplunkHost = errors.New("missing splunk host")

ErrMissingSplunkHost is returned by `NewSplunkHook` if the given configuration has no splunk host

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	SplunkHECHost string
	ToolName      string
	HostName      string
	BasicAuthUser string
	BasicAuthPass string
}

type ErrSplunkSendFailed

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

ErrSplunkSendFailed indicates that the hook failed to submit an error to Splunk.

func (ErrSplunkSendFailed) Error

func (e ErrSplunkSendFailed) Error() string

type Hook

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

Hook can be registered as a `logrus.Hook`.

func NewSplunkHook

func NewSplunkHook(config Configuration) (*Hook, error)

NewSplunkHook initializes a logrus hook which sends logs to the configured Splunk HEC. The returned object should be registered with a log via `AddHook()`

func (*Hook) Fire

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

Fire forwards a log entry to Bugsnag.

func (*Hook) Levels

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

Levels enumerates the log levels on which this hook will receive `Fire` events from logrus.

func (*Hook) Run

func (hook *Hook) Run() error

Run is part of the `genmain.Component` interface

func (*Hook) Tomb

func (hook *Hook) Tomb() *tomb.Tomb

Tomb implements the `genmain.Component` interface

Jump to

Keyboard shortcuts

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