publisher

package
v5.0.0-alpha2+incompat... Latest Latest
Warning

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

Go to latest
Published: May 2, 2016 License: Apache-2.0 Imports: 19 Imported by: 2,514

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientClosed = errors.New("client closed")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	// Close disconnects the Client from the publisher pipeline.
	Close() error

	// PublishEvent publishes one event with given options. If Sync option is set,
	// PublishEvent will block until output plugins report success or failure state
	// being returned by this method.
	PublishEvent(event common.MapStr, opts ...ClientOption) bool

	// PublishEvents publishes multiple events with given options. If Guaranteed
	// option is set, PublishEvent will block until output plugins report
	// success or failure state being returned by this method.
	PublishEvents(events []common.MapStr, opts ...ClientOption) bool
}

Client is used by beats to publish new events.

The publish methods add fields that are common to all events. Both methods add the 'beat' field that contains name and hostname. Also they add 'tags' and 'fields'.

Event publishers can override the default index for an event by adding a 'beat' field whose value is a common.MapStr that contains an 'index' field specifying the destination index.

event := common.MapStr{
    // Setting a custom index for a single event.
    "beat": common.MapStr{"index": "custom-index"},
}

Event publishers can add fields and tags to an event. The fields will take precedence over the global fields defined in the shipper configuration.

event := common.MapStr{
    // Add custom fields to the root of the event.
    common.EventMetadataKey: common.EventMetadata{
        UnderRoot: true,
        Fields:    common.MapStr{"env": "production"}
    }
}

type ClientOption

type ClientOption func(option Context) Context

ClientOption allows API users to set additional options when publishing events.

func Signal

func Signal(signaler op.Signaler) ClientOption

type Context

type Context struct {
	Signal op.Signaler
	// contains filtered or unexported fields
}

func Guaranteed

func Guaranteed(o Context) Context

Guaranteed option will retry publishing the event, until send attempt have been ACKed by output plugin.

func MakeContext

func MakeContext(opts []ClientOption) Context

func Sync

func Sync(o Context) Context

Sync option will block the event publisher until an event has been ACKed by the output plugin or failed.

type Publisher

type Publisher struct {
	IpAddrs []string

	Index          string
	Output         []*outputWorker
	TopologyOutput outputs.TopologyOutputer
	IgnoreOutgoing bool
	GeoLite        *libgeo.GeoIP
	Filters        *filter.FilterList

	RefreshTopologyTimer <-chan time.Time
	// contains filtered or unexported fields
}

func New

func New(
	beatName string,
	configs map[string]*common.Config,
	shipper ShipperConfig,
) (*Publisher, error)

Create new PublisherType

func (*Publisher) Connect

func (publisher *Publisher) Connect() Client

func (*Publisher) GetServerName

func (publisher *Publisher) GetServerName(ip string) string

func (*Publisher) IsPublisherIP

func (publisher *Publisher) IsPublisherIP(ip string) bool

func (*Publisher) PublishTopology

func (publisher *Publisher) PublishTopology(params ...string) error

func (*Publisher) RegisterFilter

func (publisher *Publisher) RegisterFilter(filters *filter.FilterList) error

func (*Publisher) Stop

func (publisher *Publisher) Stop()

func (*Publisher) UpdateTopologyPeriodically

func (publisher *Publisher) UpdateTopologyPeriodically()

type ShipperConfig

type ShipperConfig struct {
	common.EventMetadata `config:",inline"` // Fields and tags to add to each event.
	Name                 string
	RefreshTopologyFreq  time.Duration `config:"refresh_topology_freq"`
	Ignore_outgoing      bool          `config:"ignore_outgoing"`
	Topology_expire      int           `config:"topology_expire"`
	Geoip                common.Geoip  `config:"geoip"`

	// internal publisher queue sizes
	QueueSize     *int `config:"queue_size"`
	BulkQueueSize *int `config:"bulk_queue_size"`
	MaxProcs      *int `config:"max_procs"`
}

type Topology

type Topology struct {
	Name string `json:"name"`
	Ip   string `json:"ip"`
}

type TransactionalEventPublisher

type TransactionalEventPublisher interface {
	PublishTransaction(transaction op.Signaler, events []common.MapStr)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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