server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2017 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateStatistics

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

AggregateStatistics contains aggregated logging statistics

type Config

type Config struct {

	// Remote logger config
	Host         string
	Port         int
	UnixSockPath string
	TokenPath    string
	StatsPath    string

	// Local logger config
	LoggerConfig *journal.Config
}

Config contains all the configuration for the remote logger

type LogServer

type LogServer struct {
	*sync.Mutex // Mutex for tokens and statistics
	// contains filtered or unexported fields
}

LogServer implements log.Logger and log.RemoteLoggerServer interfaces

func New

func New(config *Config) (*LogServer, error)

New creates a new logserver instance

func (*LogServer) AddToken

func (l *LogServer) AddToken(service, instance string) (string, error)

AddToken creates a new token for the service/instance if it does not yet exist

func (*LogServer) AggregateServiceStatistics

func (l *LogServer) AggregateServiceStatistics() (totalVolume int64, services []*AggregateStatistics, hourly [24][2]int64)

AggregateServiceStatistics aggregates statistics

func (*LogServer) Authorize

func (l *LogServer) Authorize(ctx context.Context) error

Authorize is a gRPC interceptor that authorizes incoming RPCs

func (*LogServer) GatherStatistics

func (l *LogServer) GatherStatistics(service, instance, key, ip string, logEntry *logrpc.LogEntry)

GatherStatistics saves log-related statistics

func (*LogServer) KillSwitch

func (l *LogServer) KillSwitch() chan bool

KillSwitch returns the internal killswitch

func (*LogServer) Logfiles

func (l *LogServer) Logfiles() (map[string]string, error)

Logfiles returns statistics about available log files

func (*LogServer) Quit

func (l *LogServer) Quit()

Quit stops the server and all goroutines

func (*LogServer) RemoteLog

func (l *LogServer) RemoteLog(ctx context.Context, logEntry *logrpc.LogEntry) (*logrpc.Nothing, error)

RemoteLog handles incoming remote logs

func (*LogServer) RemoveToken

func (l *LogServer) RemoveToken(service, instance string, lock bool) error

RemoveToken removes an authentication token

func (*LogServer) RemoveTokens

func (l *LogServer) RemoveTokens(service string) error

RemoveTokens removes all the authentication tokens of a service

type ManagementConsole

type ManagementConsole interface {

	// CmdStatistics displays various statistics
	CmdStatistics(unixsock.Args) *unixsock.Response

	// CmdLogsList list all available logfiles and their archives
	CmdLogsList(unixsock.Args) *unixsock.Response

	// CmdRemoteAdd adds a remote backend
	CmdRemoteAdd(unixsock.Args) *unixsock.Response

	// CmdRemoteList lists all active remote backends
	CmdRemoteList(unixsock.Args) *unixsock.Response

	// CmdRemoteRemove removes a remote backend
	CmdRemoteRemove(unixsock.Args) *unixsock.Response

	// CmdTokensAdd adds a new token for a service/instance
	CmdTokensAdd(unixsock.Args) *unixsock.Response

	// CmdTokensListInstances lists all permitted instances of a service
	CmdTokensListInstances(unixsock.Args) *unixsock.Response

	// CmdTokensListServices lists all permitted services
	CmdTokensListServices(unixsock.Args) *unixsock.Response

	// CmdTokensRemoveInstance removes the token of a service/instance
	CmdTokensRemoveInstance(unixsock.Args) *unixsock.Response

	// CmdTokensRemoveService removes the token of all instances of a service
	CmdTokensRemoveService(unixsock.Args) *unixsock.Response

	// Execute is the executor of management console commands
	Execute(string, unixsock.Args) *unixsock.Response
}

ManagementConsole handles commands received over the unix socket

func NewConsole

func NewConsole(server *LogServer) ManagementConsole

NewConsole creates a new management console for the log server

type Statistic

type Statistic struct {
	Service         string
	Instance        string
	LogsParsed      [24]int64
	LogsParsedBytes [24]int64
	LastIP          string
	LastActive      time.Time
}

Statistic contains various log-related statistics

Jump to

Keyboard shortcuts

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