loggers

package
v0.0.0-...-c12f8f0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2017 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package loggers provides objects that gathers resource data from a host.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, constructor func() ILogger)

Register makes any logger constructor available by name.

Types

type AgentLogPayload

type AgentLogPayload struct {
	Host struct {
		Name string
		Tags map[string]string
	}
	Data struct {
		Loglines []AgentLoglinePayload
		Filename string
	}
}

type AgentLoglinePayload

type AgentLoglinePayload struct {
	Created int64
	Content string
}

type Base

type Base struct {
	Source     string
	BufferSize int64
	Targets    []resourced_config.LogTargetConfig

	Data *libmap.TSafeMapStrings
}

func (*Base) GetAndResetLoglines

func (b *Base) GetAndResetLoglines(source string) []string

GetAndResetLoglines returns loglines.

func (*Base) GetBufferSize

func (b *Base) GetBufferSize() int64

GetBufferSize returns BufferSize

func (*Base) GetLoglines

func (b *Base) GetLoglines(source string) []string

GetLoglines returns loglines.

func (*Base) GetLoglinesLength

func (b *Base) GetLoglinesLength(source string) int

GetLoglinesLength returns the count of loglines.

func (*Base) GetSource

func (b *Base) GetSource() string

GetSource returns the source field.

func (*Base) GetTargets

func (b *Base) GetTargets() []resourced_config.LogTargetConfig

GetTargets returns slice of LogTargetConfig.

func (*Base) LogErrorAndResetLoglinesIfNeeded

func (b *Base) LogErrorAndResetLoglinesIfNeeded(source string, err error, message string)

func (*Base) ProcessOutgoingLoglines

func (b *Base) ProcessOutgoingLoglines(loglines []string, allowList []string, denyList []string) []string

ProcessOutgoingLoglines before forwarding to targets.

func (*Base) PubSubKey

func (b *Base) PubSubKey(targetEndpoint string) string

PubSubKey is used for forwarding live log line from TCP listener to every target's channel.

func (*Base) ResetLoglines

func (b *Base) ResetLoglines(source string)

ResetLoglines wipes it clean.

func (*Base) RunBlockingChannel

func (b *Base) RunBlockingChannel(name string, ch <-chan interface{})

RunBlockingChannel pulls log line from channel continuously.

func (*Base) RunBlockingFile

func (b *Base) RunBlockingFile(file string)

RunBlockingFile tails the file continuously.

func (*Base) SendToAgent

func (b *Base) SendToAgent(anotherAgentAddr string, maxRetries int, loglines []string, source string) error

SendToAgent sends log lines to another agent.

func (*Base) SendToGenericTCP

func (b *Base) SendToGenericTCP(addr string, maxRetries int, loglines []string, source string) error

SendToGenericTCP sends log lines to a generic tcp endpoint.

func (*Base) SendToMaster

func (b *Base) SendToMaster(accessToken, masterURLHost, masterURLPath string, hostData *host.Host, loglines []string, source string) error

SendToMaster sends log lines to master.

func (*Base) SendToSyslog

func (b *Base) SendToSyslog(protocol string, addr string, priority syslog.Priority, tag string, loglines []string, source string) error

SendToSyslog sends log lines to syslog endpoint.

func (*Base) SetBufferSize

func (b *Base) SetBufferSize(bufferSize int64)

SetBufferSize sets BufferSize

func (*Base) SetLoglines

func (b *Base) SetLoglines(source string, loglines []string)

SetLoglines sets loglines.

func (*Base) SetSource

func (b *Base) SetSource(source string)

SetSource

func (*Base) SetTargets

func (b *Base) SetTargets(targets []resourced_config.LogTargetConfig)

SetTargets sets []LogTargetConfig

func (*Base) WriteToFile

func (b *Base) WriteToFile(targetFile string, loglines []string) error

WriteToFile writes log lines to local file.

type ILogger

type ILogger interface {
	SetSource(string)
	GetSource() string

	SetBufferSize(int64)
	GetBufferSize() int64

	SetTargets([]resourced_config.LogTargetConfig)
	GetTargets() []resourced_config.LogTargetConfig

	SetLoglines(string, []string)
	GetLoglines(string) []string
	GetLoglinesLength(string) int
	GetAndResetLoglines(string) []string
	ResetLoglines(string)
	ProcessOutgoingLoglines([]string, []string, []string) []string

	LogErrorAndResetLoglinesIfNeeded(string, error, string)

	SendToMaster(string, string, string, *host.Host, []string, string) error

	SendToAgent(string, int, []string, string) error

	SendToSyslog(string, string, syslog.Priority, string, []string, string) error

	SendToGenericTCP(string, int, []string, string) error

	WriteToFile(string, []string) error
}

ILogger is generic interface for all loggers.

func NewBase

func NewBase() ILogger

func NewGoStruct

func NewGoStruct(name string) (ILogger, error)

NewGoStruct instantiates ILogger

func NewGoStructByConfig

func NewGoStructByConfig(config resourced_config.Config) (ILogger, error)

NewGoStructByConfig instantiates ILogger given Config struct

type ILoggerChannel

type ILoggerChannel interface {
	ILogger
	PubSubKey(string) string
	RunBlockingChannel(string, <-chan interface{})
}

type ILoggerFile

type ILoggerFile interface {
	ILogger
	RunBlockingFile(string)
}

Jump to

Keyboard shortcuts

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