http

package module
v0.0.0-...-83b6ca9 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: Apache-2.0 Imports: 18 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, like this:

package main

import (
	"os"

	_ "github.com/raboof/beats-output-http/http"

	"github.com/elastic/beats/filebeat/cmd"
)

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

Then configure the http output plugin in filebeat.yaml:

output:
  http:
    hosts: ["some.example.com:80/foo"]

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

func MakeHTTP

func MakeHTTP(
	_ outputs.IndexManager,
	beat beat.Info,
	observer outputs.Observer,
	cfg *common.Config,
) (outputs.Group, error)

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
	Headers            map[string]string
	ContentType        string
}

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