outputelastic

package
v0.0.0-...-7697303 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2017 License: LGPL-3.0 Imports: 7 Imported by: 0

README

gogstash output elastic

Synopsis

{
	"output": [
		{
			"type": "elastic",

			// (required)
			"url": "http://127.0.0.1:9200",

			// (required)
			"index": "testindex",

			// (required)
			"document_type": "testtype",

			// (optional)
			"document_id": "%{fieldstring}"
		}
	]
}

Documentation

Index

Constants

View Source
const ModuleName = "elastic"

ModuleName is the name used in config file

Variables

View Source
var (
	ErrorCreateClientFailed1 = errutil.NewFactory("create elastic client failed: %q")
)

errors

Functions

func InitHandler

func InitHandler(ctx context.Context, raw *config.ConfigRaw) (config.TypeOutputConfig, error)

InitHandler initialize the output plugin

Types

type OutputConfig

type OutputConfig struct {
	config.OutputConfig
	URL          string `json:"url"`           // elastic API entrypoint
	Index        string `json:"index"`         // index name to log
	DocumentType string `json:"document_type"` // type name to log
	DocumentID   string `json:"document_id"`   // id to log, used if you want to control id format

	Sniff bool `json:"sniff"` // find all nodes of your cluster, https://github.com/olivere/elastic/wiki/Sniffing

	// BulkActions specifies when to flush based on the number of actions
	// currently added. Defaults to 1000 and can be set to -1 to be disabled.
	BulkActions int `json:"bulk_actions,omitempty"`

	// BulkSize specifies when to flush based on the size (in bytes) of the actions
	// currently added. Defaults to 5 MB and can be set to -1 to be disabled.
	BulkSize int `json:"bulk_size,omitempty"`

	// BulkFlushInterval specifies when to flush at the end of the given interval.
	// Defaults to 30 seconds. If you want the bulk processor to
	// operate completely asynchronously, set both BulkActions and BulkSize to
	// -1 and set the FlushInterval to a meaningful interval.
	BulkFlushInterval time.Duration `json:"bulk_flush_interval"`
	// contains filtered or unexported fields
}

OutputConfig holds the configuration json fields and internal objects

func DefaultOutputConfig

func DefaultOutputConfig() OutputConfig

DefaultOutputConfig returns an OutputConfig struct with default values

func (*OutputConfig) Output

func (t *OutputConfig) Output(ctx context.Context, event logevent.LogEvent) (err error)

Output event

Jump to

Keyboard shortcuts

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