logmux

package
v0.0.0-...-c283e9f Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2021 License: BSD-3-Clause Imports: 38 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDBClosed = errors.New("sink DB closed")
View Source
var SinkExistsError = errors.New("sink with that id already exists")
View Source
var SinkNotFoundError = errors.New("sink with that id couldn't be found")

Functions

This section is empty.

Types

type Config

type Config struct {
	AppID, HostID, JobID, JobType string
}

type JobStateGetter

type JobStateGetter interface {
	GetJob(id string) *host.ActiveJob
}

type LogAggregatorSink

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

func NewLogAggregatorSink

func NewLogAggregatorSink(sm *SinkManager, info *SinkInfo) (*LogAggregatorSink, error)

func (*LogAggregatorSink) Close

func (s *LogAggregatorSink) Close()

func (*LogAggregatorSink) Connect

func (s *LogAggregatorSink) Connect() error

func (*LogAggregatorSink) GetCursor

func (s *LogAggregatorSink) GetCursor(hostID string) (*utils.HostCursor, error)

func (*LogAggregatorSink) Info

func (s *LogAggregatorSink) Info() *SinkInfo

func (*LogAggregatorSink) Name

func (s *LogAggregatorSink) Name() string

func (*LogAggregatorSink) Shutdown

func (s *LogAggregatorSink) Shutdown()

func (*LogAggregatorSink) ShutdownCh

func (s *LogAggregatorSink) ShutdownCh() chan struct{}

func (*LogAggregatorSink) Write

func (s *LogAggregatorSink) Write(m message) error

type LogStream

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

func (*LogStream) Close

func (s *LogStream) Close() string

type Mux

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

LogMux collects log lines from multiple leaders and forwards them to logaggregator instances and local files.

func New

func New(hostID, logDir string, logger log15.Logger) *Mux

func (*Mux) Follow

func (m *Mux) Follow(r io.ReadCloser, buffer string, msgID logagg.MsgID, config *Config) *LogStream

Follow starts a goroutine that reads log lines from the reader into the mux. It runs until the reader is closed or an error occurs. If an error occurs, the reader may still be open.

func (*Mux) Logger

func (m *Mux) Logger(msgID logagg.MsgID, config *Config, ctx ...interface{}) *MuxLogger

func (*Mux) StreamLog

func (m *Mux) StreamLog(appID, jobID string, history, follow bool, ch chan<- *rfc5424.Message) (stream.Stream, error)

type MuxLogger

type MuxLogger struct {
	log15.Logger
	*LogStream
}

type Sink

type Sink interface {
	Info() *SinkInfo
	Name() string
	Connect() error
	Close()
	GetCursor(hostID string) (*utils.HostCursor, error)
	Write(m message) error
	Shutdown()
	ShutdownCh() chan struct{}
}

type SinkHTTPAPI

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

func (*SinkHTTPAPI) AddSink

func (s *SinkHTTPAPI) AddSink(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*SinkHTTPAPI) GetSinks

func (s *SinkHTTPAPI) GetSinks(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

func (*SinkHTTPAPI) RemoveSink

func (s *SinkHTTPAPI) RemoveSink(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

type SinkInfo

type SinkInfo struct {
	ID          string            `json:"id"`
	Kind        ct.SinkKind       `json:"kind"`
	Cursor      *utils.HostCursor `json:"cursor,omitempty"`
	Config      json.RawMessage   `json:"config"`
	HostManaged bool              `json:"host_managed"`
}

type SinkManager

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

func NewSinkManager

func NewSinkManager(dbPath string, mux *Mux, state JobStateGetter, logger log15.Logger) *SinkManager

func (*SinkManager) AddSink

func (sm *SinkManager) AddSink(id string, s *SinkInfo) error

func (*SinkManager) CloseDB

func (sm *SinkManager) CloseDB() error

func (*SinkManager) OpenDB

func (sm *SinkManager) OpenDB() error

func (*SinkManager) RegisterRoutes

func (sm *SinkManager) RegisterRoutes(r *httprouter.Router)

func (*SinkManager) RemoveSink

func (sm *SinkManager) RemoveSink(id string) error

func (*SinkManager) StreamToAggregators

func (sm *SinkManager) StreamToAggregators(s discoverd.Service) error

type SyslogSink

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

SyslogSink is a flexible sink that can connect to TCP/TLS endpoints that use syslog framing. The prefix of the message can be customised using a template.

func NewSyslogSink

func NewSyslogSink(sm *SinkManager, info *SinkInfo) (sink *SyslogSink, err error)

func (*SyslogSink) Close

func (s *SyslogSink) Close()

func (*SyslogSink) Connect

func (s *SyslogSink) Connect() error

func (*SyslogSink) GetCursor

func (s *SyslogSink) GetCursor(_ string) (*utils.HostCursor, error)

func (*SyslogSink) Info

func (s *SyslogSink) Info() *SinkInfo

func (*SyslogSink) Name

func (s *SyslogSink) Name() string

func (*SyslogSink) Shutdown

func (s *SyslogSink) Shutdown()

func (*SyslogSink) ShutdownCh

func (s *SyslogSink) ShutdownCh() chan struct{}

func (*SyslogSink) Write

func (s *SyslogSink) Write(m message) error

Jump to

Keyboard shortcuts

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