server

package
v0.0.0-...-9742f5a Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2020 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultLogSize is the maximum size bundle we will accept. If unaccepted, it
	// will return ErrBundleTooLarge to the grpc client.
	DefaultLogSize = 10 * 1024 * 1024
)

Variables

View Source
var ErrFailedProcessing = errors.New("failed processing due to transient error; retrying")

ErrFailedProcessing indicates a failure in processing that can be retried

Functions

This section is empty.

Types

type Config

type Config struct {
	IndexName     string
	ListenAddress string
	SpoolDir      string
	MaxLogSize    uint64
	ElasticSearch es.Config
	KVMember      string
	Logger        *logrus.Logger

	RateLimiting    bool
	RateLimitConfig ratelimit.Config

	Processor func(file *FileMeta) error
}

Config is the configuration of the server.

type FileMeta

type FileMeta struct {
	PubKey []byte
	Name   string
	IPAddr string
}

FileMeta is a simple struct for passing ip info with filenames... Private; mostly public for json serialization.

type LogPipe

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

LogPipe pipes data from protobuf-generated logs (see log/client.go for the client) to elasticsearch in a structured fashion. Logs are delivered as bundles, which are signed and tagged with a public key that corresponds to the client. Each bundle is stored locally and delivered to ES from disk.

func NewLogPipe

func NewLogPipe(config Config) (*LogPipe, error)

NewLogPipe creates a LogPipe server.

func (*LogPipe) Boot

func (lp *LogPipe) Boot(ready chan struct{}, db *sql.DB) error

Boot boots the service. It returns error if it cannot, or if there was an error that occurred while serving. This function will block until the server is stopped. It will close the `ready` channel you pass when ready to serve.

func (*LogPipe) Close

func (lp *LogPipe) Close(timeout time.Duration) error

Close closes the server. If a timeout is given, it will sleep for that long between shutting down grpc and closing the listener, allowing for cleanup to potentially occur.

func (*LogPipe) ListenAddr

func (lp *LogPipe) ListenAddr() string

ListenAddr reports the listener address, especially for when binding to :0. returns an empty string if the listener is empty.

func (*LogPipe) ReceiveLogs

func (lp *LogPipe) ReceiveLogs(lf log.LogPipe_ReceiveLogsServer) (retErr error)

ReceiveLogs receives the logs for processing. Spins out a goroutine to send to ES once received.

Jump to

Keyboard shortcuts

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