outputs

package
v6.0.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotACertificate indicates a PEM file to be loaded not being a valid
	// PEM file or certificate.
	ErrNotACertificate = errors.New("file is not a certificate")

	// ErrCertificateNoKey indicate a configuration error with missing key file
	ErrCertificateNoKey = errors.New("key file not configured")

	// ErrKeyNoCertificate indicate a configuration error with missing certificate file
	ErrKeyNoCertificate = errors.New("certificate file not configured")
)
View Source
var (
	// ErrNoConnectionConfigured indicates no configured connections for publishing.
	ErrNoConnectionConfigured = errors.New("No connection configured")
)

Functions

func LoadTLSConfig

func LoadTLSConfig(config *TLSConfig) (*transport.TLSConfig, error)

LoadTLSConfig will load a certificate from config with all TLS based keys defined. If Certificate and CertificateKey are configured, client authentication will be configured. If no CAs are configured, the host CA will be used by go built-in TLS support.

func Plugin

func Plugin(name string, f Factory) map[string][]interface{}

func ReadHostList

func ReadHostList(cfg *common.Config) ([]string, error)

ReadHostList reads a list of hosts to connect to from an configuration object. If the `workers` settings is > 1, each host is duplicated in the final host list by the number of `workers`.

func RegisterType

func RegisterType(name string, f Factory)

RegisterType registers a new output type.

Types

type CertificateConfig

type CertificateConfig struct {
	Certificate string `config:"certificate"`
	Key         string `config:"key"`
	Passphrase  string `config:"key_passphrase"`
}

type Client

type Client interface {
	Close() error

	// Publish sends events to the clients sink. A client must synchronously or
	// asynchronously ACK the given batch, once all events have been processed.
	// Using Retry/Cancelled a client can return a batch of unprocessed events to
	// the publisher pipeline. The publisher pipeline (if configured by the output
	// factory) will take care of retrying/dropping events.
	Publish(publisher.Batch) error
}

Client provides the minimal interface an output must implement to be usable with the publisher pipeline.

func NetworkClients

func NetworkClients(netclients []NetworkClient) []Client

NetworkClients converts a list of NetworkClient instances into []Client.

type Connectable

type Connectable interface {
	// Connect establishes a connection to the clients sink.
	// The connection attempt shall report an error if no connection could been
	// established within the given time interval. A timeout value of 0 == wait
	// forever.
	Connect() error
}

Connectable is optionally implemented by clients that might be able to close and reconnect dynamically.

type Factory

type Factory func(
	beat beat.Info,
	stats *Stats,
	cfg *common.Config) (Group, error)

Factory is used by output plugins to build an output instance

func FindFactory

func FindFactory(name string) Factory

FindFactory finds an output type its factory if available.

type Group

type Group struct {
	Clients   []Client
	BatchSize int
	Retry     int
}

Group configures and combines multiple clients into load-balanced group of clients being managed by the publisher pipeline.

func Fail

func Fail(err error) (Group, error)

Fail helper can be used by output factories, to create a failure response when loading an output must return an error.

func Load

func Load(info beat.Info, stats *Stats, name string, config *common.Config) (Group, error)

Load creates and configures a output Group using a configuration object..

func Success

func Success(batchSize, retry int, clients ...Client) (Group, error)

Success create a valid output Group response for a set of client instances.

func SuccessNet

func SuccessNet(loadbalance bool, batchSize, retry int, netclients []NetworkClient) (Group, error)

type NetworkClient

type NetworkClient interface {
	Client
	Connectable
}

NetworkClient defines the required client capabilites for network based outputs, that must be reconnectable.

func NewFailoverClient

func NewFailoverClient(clients []NetworkClient) NetworkClient

NewFailoverClient combines a set of NetworkClients into one NetworkClient instances, with at most one active client. If the active client fails, another client will be used.

func WithBackoff

func WithBackoff(client NetworkClient, init, max time.Duration) NetworkClient

WithBackoff wraps a NetworkClient, adding exponential backoff support to a network client if connection/publishing failed.

type Stats

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

Stats provides a common type used by outputs to report common events. The output events will update a set of unified output metrics in the underlying monitoring.Registry.

func MakeStats

func MakeStats(reg *monitoring.Registry) Stats

func (*Stats) Acked

func (s *Stats) Acked(n int)

func (*Stats) Cancelled

func (s *Stats) Cancelled(n int)

func (*Stats) Dropped

func (s *Stats) Dropped(n int)

func (*Stats) Failed

func (s *Stats) Failed(n int)

func (*Stats) NewBatch

func (s *Stats) NewBatch(n int)

func (*Stats) ReadBytes

func (s *Stats) ReadBytes(n int)

func (*Stats) ReadError

func (s *Stats) ReadError()

func (*Stats) WriteBytes

func (s *Stats) WriteBytes(n int)

func (*Stats) WriteError

func (s *Stats) WriteError()

type TLSConfig

type TLSConfig struct {
	Enabled          *bool                         `config:"enabled"`
	VerificationMode transport.TLSVerificationMode `config:"verification_mode"` // one of 'none', 'full'
	Versions         []transport.TLSVersion        `config:"supported_protocols"`
	CipherSuites     []tlsCipherSuite              `config:"cipher_suites"`
	CAs              []string                      `config:"certificate_authorities"`
	Certificate      CertificateConfig             `config:",inline"`
	CurveTypes       []tlsCurveType                `config:"curve_types"`
}

TLSConfig defines config file options for TLS clients.

func (*TLSConfig) IsEnabled

func (c *TLSConfig) IsEnabled() bool

func (*TLSConfig) Validate

func (c *TLSConfig) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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