http

package module
v6.7.0-1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

README

beats-output-http

Outputter for the Elastic Beats platform that simply POSTs events to an HTTP endpoint.

Build Status

Usage

To add support for this output plugin to a beat, you have to import this plugin into your main beats package (e.g. elastic/beats/filebeat/main.go), like this:

package main

import (
  "os"

  "github.com/elastic/beats/filebeat/cmd"
  _ "github.com/mbrancato/beats-output-http"
)

func main() {
  if err := cmd.RootCmd.Execute(); err != nil {
    os.Exit(1)
  }
}

Then configure the http output plugin in your beat config (e.g. filebeat.yml):

output:
  http:
    hosts: ["host.example.com"]
    protocol: "http"
    path: "messages"

More details of config options can be found in the configuration_example.yml file.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotConnected indicates failure due to client having no valid connection
	ErrNotConnected = errors.New("not connected")

	// ErrJSONEncodeFailed indicates encoding failures
	ErrJSONEncodeFailed = errors.New("json encode failed")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Connection
	// contains filtered or unexported fields
}

Client struct

func NewClient

func NewClient(s ClientSettings) (*Client, error)

NewClient instantiate a client.

func (*Client) BatchPublishEvent

func (client *Client) BatchPublishEvent(data []publisher.Event) error

BatchPublishEvent publish a single event to output.

func (*Client) Clone

func (client *Client) Clone() *Client

Clone clones a client.

func (*Client) Publish

func (client *Client) Publish(batch publisher.Batch) error

Publish sends events to the clients sink.

func (*Client) PublishEvent

func (client *Client) PublishEvent(data publisher.Event) error

PublishEvent publish a single event to output.

func (*Client) String

func (client *Client) String() string

type ClientSettings

type ClientSettings struct {
	URL                string
	Proxy              *url.URL
	TLS                *transport.TLSConfig
	Username, Password string
	Parameters         map[string]string
	Index              outil.Selector
	Pipeline           *outil.Selector
	Timeout            time.Duration
	CompressionLevel   int
	Observer           outputs.Observer
	BatchPublish       bool

	ContentType string
	// contains filtered or unexported fields
}

ClientSettings struct

type Connection

type Connection struct {
	URL      string
	Username string
	Password string

	ContentType string
	// contains filtered or unexported fields
}

Connection struct

func (*Connection) Close

func (conn *Connection) Close() error

Close closes a connection.

func (*Connection) Connect

func (conn *Connection) Connect() error

Connect establishes a connection to the clients sink.

Jump to

Keyboard shortcuts

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