outputs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2015 License: Apache-2.0 Imports: 8 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")

	// ErrInvalidTLSVersion indicates an unknown tls version string given.
	ErrInvalidTLSVersion = errors.New("invalid TLS version string")

	// ErrUnknownCipherSuite indicates an unknown tls cipher suite being used
	ErrUnknownCipherSuite = errors.New("unknown cypher suite")

	// ErrUnknownCurveID indicates an unknown curve id has been configured
	ErrUnknownCurveID = errors.New("unknown curve id")
)

Functions

func LoadTLSConfig

func LoadTLSConfig(config *TLSConfig) (*tls.Config, 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 RegisterOutputPlugin

func RegisterOutputPlugin(name string, builder OutputBuilder)

func Signal

func Signal(s Signaler, err error)

Signal will send the Completed or Failed event to s depending on err being set if s is not nil.

func SignalAll

func SignalAll(signalers []Signaler, err error)

SignalAll send the Completed or Failed event to all given signalers depending on err being set.

func SignalCompleted

func SignalCompleted(s Signaler)

SignalCompleted sends the Completed event to s if s is not nil.

func SignalFailed

func SignalFailed(s Signaler, err error)

SignalFailed sends the Failed event to s if s is not nil

Types

type BulkOutputer

type BulkOutputer interface {
	Outputer
	BulkPublish(trans Signaler, ts time.Time, event []common.MapStr) error
}

BulkOutputer adds BulkPublish to publish batches of events without looping. Outputers still might loop on events or use more efficient bulk-apis if present.

func CastBulkOutputer

func CastBulkOutputer(out Outputer) BulkOutputer

CastBulkOutputer casts out into a BulkOutputer if out implements the BulkOutputer interface. If out does not implement the interface an outputer wrapper implementing the BulkOutputer interface is returned.

type ChanSignal

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

ChanSignal will send outputer signals on configurable channel.

func NewChanSignal

func NewChanSignal(ch chan bool) *ChanSignal

NewChanSignal create a new ChanSignal forwarding signals to a channel.

func (*ChanSignal) Completed

func (c *ChanSignal) Completed()

Completed sends true to the confiugred channel.

func (*ChanSignal) Failed

func (c *ChanSignal) Failed()

Failed sends false to the confiugred channel.

type CompositeSignal

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

CompositeSignal combines multiple signalers into one Signaler forwarding an event to to all signalers.

func (*CompositeSignal) Completed

func (cs *CompositeSignal) Completed()

Completed sends the Completed signal to all signalers.

func (*CompositeSignal) Failed

func (cs *CompositeSignal) Failed()

Failed sends the Failed signal to all signalers.

type MothershipConfig

type MothershipConfig struct {
	Save_topology      bool
	Host               string
	Port               int
	Hosts              []string
	LoadBalance        *bool
	Protocol           string
	Username           string
	Password           string
	Index              string
	Path               string
	Db                 int
	Db_topology        int
	Timeout            int
	Reconnect_interval int
	Filename           string
	Rotate_every_kb    int
	Number_of_files    int
	DataType           string
	Flush_interval     *int
	BulkMaxSize        *int `yaml:"bulk_max_size"`
	Max_retries        *int
	Pretty             *bool
	TLS                *TLSConfig
	Worker             int
}

type OutputBuilder

type OutputBuilder interface {
	// Create and initialize the output plugin
	NewOutput(
		beat string,
		config *MothershipConfig,
		topologyExpire int) (Outputer, error)
}

func FindOutputPlugin

func FindOutputPlugin(name string) OutputBuilder

type OutputInterface

type OutputInterface interface {
	Outputer
	TopologyOutputer
}

Functions to be exported by a output plugin

type OutputPlugin

type OutputPlugin struct {
	Name   string
	Config MothershipConfig
	Output Outputer
}

func InitOutputs

func InitOutputs(
	beat string,
	configs map[string]MothershipConfig,
	topologyExpire int,
) ([]OutputPlugin, error)

type Outputer

type Outputer interface {
	// Publish event
	PublishEvent(trans Signaler, ts time.Time, event common.MapStr) error
}

type Signaler

type Signaler interface {
	Completed()

	Failed()
}

Signaler signals the completion of potentially asynchronous output operation. Completed is called by the output plugin when all events have been sent. On failure or if only a subset of the data is published then Failed will be invoked.

func NewCompositeSignaler

func NewCompositeSignaler(signalers ...Signaler) Signaler

NewCompositeSignaler creates a new composite signaler.

func NewSplitSignaler

func NewSplitSignaler(
	s Signaler,
	count int,
) Signaler

NewSplitSignaler creates a new SplitSignal if s is not nil. If s is nil, nil will be returned. The count is the number of events to be received before publishing the final event to the guarded Signaler.

type SplitSignal

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

SplitSignal guards one output signaler from multiple calls by using a simple reference counting scheme. If one Signaler consumer reports a Failed event, the Failed event will be send to the guarded Signaler once the reference count becomes zero.

Example use cases:

  • Push signaler to multiple outputers
  • split data to be send in smaller batches

func (*SplitSignal) Completed

func (s *SplitSignal) Completed()

Completed signals a Completed event to s.

func (*SplitSignal) Failed

func (s *SplitSignal) Failed()

Failed signals a Failed event to s.

type SyncSignal

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

SyncSignal blocks waiting for a signal.

func NewSyncSignal

func NewSyncSignal() *SyncSignal

NewSyncSignal create a new SyncSignal signaler. Use Wait() method to wait for a signal from the publisher

func (*SyncSignal) Completed

func (s *SyncSignal) Completed()

Completed sends true to the process waiting for a signal.

func (*SyncSignal) Failed

func (s *SyncSignal) Failed()

Failed sends false to the process waiting for a signal.

func (*SyncSignal) Wait

func (s *SyncSignal) Wait() bool

Wait blocks waiting for a signal from the outputer. Wait return true if Completed was signaled and false if a Failed signal was received

type TLSConfig

type TLSConfig struct {
	Certificate    string   `yaml:"certificate"`
	CertificateKey string   `yaml:"certificate_key"`
	CAs            []string `yaml:"certificate_authorities"`
	Insecure       bool     `yaml:"insecure,omitempty"`
	CipherSuites   []string `yaml:"cipher_suites"`
	MinVersion     string   `yaml:"min_version,omitempty"`
	MaxVersion     string   `yaml:"max_version,omitempty"`
	CurveTypes     []string `yaml:"curve_types"`
}

TLSConfig defines config file options for TLS clients.

type TopologyOutputer

type TopologyOutputer interface {
	// Register the agent name and its IPs to the topology map
	PublishIPs(name string, localAddrs []string) error

	// Get the agent name with a specific IP from the topology map
	GetNameByIP(ip string) string
}

Directories

Path Synopsis
Package mode defines and implents output strategies with failover or load balancing modes for use by output plugins.
Package mode defines and implents output strategies with failover or load balancing modes for use by output plugins.

Jump to

Keyboard shortcuts

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