server

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataService

type DataService interface {
	Find(req core.Request) ([]core.LogEntry, error)
	LastPublished() (entry core.LogEntry, err error)
}

DataService is accessor to store

type FileLogger

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

FileLogger contains writers for containers and merged writer for all sources

func NewFileLogger

func NewFileLogger(wrf WritersFactory, m io.Writer) *FileLogger

NewFileLogger creates FileLogger for provided WritersFactory (per host/container) and merged writer

func (*FileLogger) Write

func (r *FileLogger) Write(rec core.LogEntry) error

Write log entry to local files

type FileWriter

type FileWriter interface {
	Write(rec core.LogEntry) error
}

FileWriter writes entry to all log files

type Forwarder

type Forwarder struct {
	Publisher  Publisher
	Syslog     SyslogBackgroundReader
	FileWriter FileWriter
}

Forwarder tails syslog messages, parses entries and pushes to Publisher (store) and file logger(s)

func (*Forwarder) Run

func (f *Forwarder) Run(ctx context.Context) error

Run executes forwarder in endless (blocking) loop

type Mongo

type Mongo struct {
	*mdrv.Client
	MongoParams
	// contains filtered or unexported fields
}

Mongo store provides all mongo-related ops

func NewMongo

func NewMongo(client *mdrv.Client, params MongoParams) (res *Mongo, err error)

NewMongo makes Mongo accessor

func (*Mongo) Find

func (m *Mongo) Find(req core.Request) ([]core.LogEntry, error)

Find records matching given request

func (*Mongo) LastPublished

func (m *Mongo) LastPublished() (entry core.LogEntry, err error)

LastPublished returns latest published entry

func (*Mongo) Publish

func (m *Mongo) Publish(records []core.LogEntry) (err error)

Publish inserts buffer to mongo

type MongoParams

type MongoParams struct {
	MaxDocs            int
	MaxCollectionSize  int
	Delay              time.Duration
	DBName, Collection string
}

MongoParams has all inputs (except dial info) needed to initialize mongo store

type Publisher

type Publisher interface {
	Publish(records []core.LogEntry) (err error)
	LastPublished() (entry core.LogEntry, err error)
}

Publisher to store

type RestServer

type RestServer struct {
	Port           int
	DataService    DataService
	Limit          int // request limit, i.e. max number of records any single Find can return
	Version        string
	StreamDuration time.Duration
}

RestServer is a basic rest server to access msgs from DataService

func (*RestServer) Run

func (s *RestServer) Run(ctx context.Context) error

Run the lister and request's router

type Syslog

type Syslog struct {
	Port int
	// contains filtered or unexported fields
}

Syslog server on TCP & UDP 5514. Should be mapped to 514 in compose

func (*Syslog) Go

func (s *Syslog) Go(ctx context.Context) (<-chan string, error)

Go starts syslog server in background and returns channel with messages

type SyslogBackgroundReader

type SyslogBackgroundReader interface {
	Go(ctx context.Context) (<-chan string, error)
}

SyslogBackgroundReader provides aysnc runner returning the channel for incoming messages

type WritersFactory

type WritersFactory func(host, container string) io.Writer

WritersFactory is a type for func returning io.Writer for given host and container

Jump to

Keyboard shortcuts

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