outputs

package
v6.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 11, 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 LoadCertificate

func LoadCertificate(config *CertificateConfig) (*tls.Certificate, error)

func LoadCertificateAuthorities

func LoadCertificateAuthorities(CAs []string) (*x509.CertPool, []error)

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 ReadPEMFile

func ReadPEMFile(path, passphrase string) ([]byte, error)

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 Observer,
	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 Observer, 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 capabilities 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 Observer

type Observer interface {
	NewBatch(int)     // report new batch being processed with number of events
	Acked(int)        // report number of acked events
	Failed(int)       // report number of failed events
	Dropped(int)      // report number of dropped events
	Cancelled(int)    // report number of cancelled events
	WriteError(error) // report an I/O error on write
	WriteBytes(int)   // report number of bytes being written
	ReadError(error)  // report an I/O error on read
	ReadBytes(int)    // report number of bytes being read
}

Observer provides an interface used by outputs to report common events on documents/events being published and I/O workload.

func NewNilObserver

func NewNilObserver() Observer

NewNilObserver returns an oberserver implementation, ignoring all events.

type Stats

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

Stats implements the Observer interface, for collecting metrics on common outputs events.

func NewStats

func NewStats(reg *monitoring.Registry) *Stats

NewStats creates a new Stats instance using a backing monitoring registry. This function will create and register a number of metrics with the registry passed. The registry must not be null.

func (*Stats) Acked

func (s *Stats) Acked(n int)

Acked updates active and acked event metrics.

func (*Stats) Cancelled

func (s *Stats) Cancelled(n int)

Cancelled updates the active event metrics.

func (*Stats) Dropped

func (s *Stats) Dropped(n int)

Dropped updates total number of event drops as reported by the output. Outputs will only report dropped events on fatal errors which lead to the event not being publishabel. For example encoding errors or total event size being bigger then maximum supported event size.

func (*Stats) Failed

func (s *Stats) Failed(n int)

Failed updates active and failed event metrics.

func (*Stats) NewBatch

func (s *Stats) NewBatch(n int)

NewBatch updates active batch and event metrics.

func (*Stats) ReadBytes

func (s *Stats) ReadBytes(n int)

ReadBytes updates the total number of bytes read/received by an output.

func (*Stats) ReadError

func (s *Stats) ReadError(err error)

ReadError increases the read I/O error metrics.

func (*Stats) WriteBytes

func (s *Stats) WriteBytes(n int)

WriteBytes updates the total number of bytes written/send by an output.

func (*Stats) WriteError

func (s *Stats) WriteError(err error)

WriteError increases the write I/O error metrics.

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"`
	Renegotiation    tlsRenegotiationSupport       `config:"renegotiation"`
}

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