Documentation ¶
Overview ¶
Package loggers provides objects that gathers resource data from a host.
Index ¶
- func Register(name string, constructor func() ILogger)
- type AgentLogPayload
- type AgentLoglinePayload
- type Base
- func (b *Base) GetAndResetLoglines(source string) []string
- func (b *Base) GetBufferSize() int64
- func (b *Base) GetLoglines(source string) []string
- func (b *Base) GetLoglinesLength(source string) int
- func (b *Base) GetSource() string
- func (b *Base) GetTargets() []resourced_config.LogTargetConfig
- func (b *Base) LogErrorAndResetLoglinesIfNeeded(source string, err error, message string)
- func (b *Base) ProcessOutgoingLoglines(loglines []string, allowList []string, denyList []string) []string
- func (b *Base) PubSubKey(targetEndpoint string) string
- func (b *Base) ResetLoglines(source string)
- func (b *Base) RunBlockingChannel(name string, ch <-chan interface{})
- func (b *Base) RunBlockingFile(file string)
- func (b *Base) SendToAgent(anotherAgentAddr string, maxRetries int, loglines []string, source string) error
- func (b *Base) SendToGenericTCP(addr string, maxRetries int, loglines []string, source string) error
- func (b *Base) SendToMaster(accessToken, masterURLHost, masterURLPath string, hostData *host.Host, ...) error
- func (b *Base) SendToSyslog(protocol string, addr string, priority syslog.Priority, tag string, ...) error
- func (b *Base) SetBufferSize(bufferSize int64)
- func (b *Base) SetLoglines(source string, loglines []string)
- func (b *Base) SetSource(source string)
- func (b *Base) SetTargets(targets []resourced_config.LogTargetConfig)
- func (b *Base) WriteToFile(targetFile string, loglines []string) error
- type ILogger
- type ILoggerChannel
- type ILoggerFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentLogPayload ¶
type AgentLogPayload struct { Host struct { Name string Tags map[string]string } Data struct { Loglines []AgentLoglinePayload Filename string } }
type AgentLoglinePayload ¶
type Base ¶
type Base struct { Source string BufferSize int64 Targets []resourced_config.LogTargetConfig Data *libmap.TSafeMapStrings }
func (*Base) GetAndResetLoglines ¶
GetAndResetLoglines returns loglines.
func (*Base) GetLoglines ¶
GetLoglines returns loglines.
func (*Base) GetLoglinesLength ¶
GetLoglinesLength returns the count of loglines.
func (*Base) GetTargets ¶
func (b *Base) GetTargets() []resourced_config.LogTargetConfig
GetTargets returns slice of LogTargetConfig.
func (*Base) LogErrorAndResetLoglinesIfNeeded ¶
func (*Base) ProcessOutgoingLoglines ¶
func (b *Base) ProcessOutgoingLoglines(loglines []string, allowList []string, denyList []string) []string
ProcessOutgoingLoglines before forwarding to targets.
func (*Base) PubSubKey ¶
PubSubKey is used for forwarding live log line from TCP listener to every target's channel.
func (*Base) ResetLoglines ¶
ResetLoglines wipes it clean.
func (*Base) RunBlockingChannel ¶
RunBlockingChannel pulls log line from channel continuously.
func (*Base) RunBlockingFile ¶
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 ¶
SetBufferSize sets BufferSize
func (*Base) SetLoglines ¶
SetLoglines sets loglines.
func (*Base) SetTargets ¶
func (b *Base) SetTargets(targets []resourced_config.LogTargetConfig)
SetTargets sets []LogTargetConfig
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 NewGoStructByConfig ¶
func NewGoStructByConfig(config resourced_config.Config) (ILogger, error)
NewGoStructByConfig instantiates ILogger given Config struct