outputhttp

package
v0.0.0-...-c13075e Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 13 Imported by: 0

README

gogstash output http

Synopsis

output:
  - type: http
    # (required)
    # Endpoints to publish to (one in list is random chosen)
    urls: ["http://127.0.0.1/post"]

    # (optional)
    # HTTP status codes that indicates that message is delivered successfully, default list below
    http_status_codes: [200, 201, 202]

    # (optional)
    # HTTP status codes that indicates that message failed with an error where it is not possible to retry to send the
    # message, default list below
    http_error_codes: [501, 405, 404, 208, 505]

    # (optional)
    # How often to retry to send messages in case it was not delivered successfully, default is 30 seconds
    retry_interval: 30

    # (optional)
    # The maximum size of messages that can be queued (in case of delivery issues) before messages are dropped.
    # Default is one message, use -1 to not limit the queue.
    max_queue_size: 1

    # (optional)
    # true if you want to disable SSL/TLS validation of remote endpoint, default is false
    ignore_ssl: true

Documentation

Index

Constants

View Source
const ModuleName = "http"

ModuleName is the name used in config file

Variables

View Source
var (
	ErrNoValidURLs    = errutil.NewFactory("no valid URLs found")
	ErrEndpointDown1  = errutil.NewFactory("%q endpoint down")
	ErrPermanentError = errutil.NewFactory("%q permanent error %v (discarding event)")
	ErrSoftError      = errutil.NewFactory("%q retryable error %v")
)

errors

Functions

func InitHandler

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

InitHandler initialize the output plugin

func MapFromInts

func MapFromInts(nums []int) map[int]struct{}

MapFromInts returns a map containing all the ints in the array

Types

type OutputConfig

type OutputConfig struct {
	config.OutputConfig
	URLs                []string `json:"urls" yaml:"urls"`                           // Array of HTTP connection strings
	AcceptedHttpResult  []int    `json:"http_status_codes" yaml:"http_status_codes"` // HTTP codes that indicate success
	PermanentHttpErrors []int    `json:"http_error_codes" yaml:"http_error_codes"`   // HTTP codes that will not retry an event
	RetryInterval       uint     `json:"retry_interval" yaml:"retry_interval"`       // seconds before a new retry in case on error
	IgnoreSSL           bool     `json:"ignore_ssl" yaml:"ignore_ssl"`
	MaxQueueSize        int      `json:"max_queue_size" yaml:"max_queue_size"` // max size of queue before deleting events (-1=no limit, 0=disable)
	// 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) OutputEvent

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

OutputEvent tries to send a message, requeueing if is has a temporary error

Jump to

Keyboard shortcuts

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