httpl

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

README

Httpl Input Plugin

The httpl input plugin serves requests on configured address and streams request body to parser line by line. This plugin requires parser.

If all body parsed without errors, plugin returns 200 OK with accepted events: N body. If reading error occures, plugin returns 500 Internal Server Error, if parsing error occures, it's 400 Bad Request.

This plugin produce events with routing key as request path, server label with configured address and sender label with request RemoteAddr address.

[!TIP]
This plugin may write it's own metrics

Configuration

[[inputs]]
  [inputs.httpl]
    # if true, plugin server writes it's own metrics
    enable_metrics = false

    # address and port to host HTTP listener on
    address = ":9200"

    # number of maximum simultaneous connections
    max_connections = 10

    # maximum duration before timing out read of the request
    read_timeout = "10s"

    # maximum duration before timing out write of the response
    write_timeout = "10s"

    # if configured, an event id will be set by data from path
    # expected format - "type:path"
    id_from = "field:path.to.id"

    ## TLS configuration
    # if true, TLS listener will be used
    tls_enable = false
    # service key and certificate
    tls_key_file = "/etc/neptunus/key.pem"
    tls_cert_file = "/etc/neptunus/cert.pem"
    # one or more allowed client CA certificate file names to
    # enable mutually authenticated TLS connections
    tls_allowed_cacerts = [ "/etc/neptunus/clientca.pem" ]
    # minimum and maximum TLS version accepted by the service
    # not limited by default
    tls_min_version = "TLS12"
    tls_max_version = "TLS13"

    # a "label name -> header" map
    # if request header exists, it will be saved as configured label
    [inputs.httpl.labelheaders]
      length = "Content-Length"
      encoding = "Content-Type"

    [inputs.httpl.parser]
      type = "json"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Httpl

type Httpl struct {
	*core.BaseInput `mapstructure:"-"`
	EnableMetrics   bool              `mapstructure:"enable_metrics"`
	Address         string            `mapstructure:"address"`
	ReadTimeout     time.Duration     `mapstructure:"read_timeout"`
	WriteTimeout    time.Duration     `mapstructure:"write_timeout"`
	MaxConnections  int               `mapstructure:"max_connections"`
	LabelHeaders    map[string]string `mapstructure:"labelheaders"`

	*ider.Ider              `mapstructure:",squash"`
	*pkgtls.TLSServerConfig `mapstructure:",squash"`
	// contains filtered or unexported fields
}

func (*Httpl) Close

func (i *Httpl) Close() error

func (*Httpl) Init

func (i *Httpl) Init() error

func (*Httpl) Run

func (i *Httpl) Run()

func (*Httpl) ServeHTTP

func (i *Httpl) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Httpl) SetParser

func (i *Httpl) SetParser(p core.Parser)

Jump to

Keyboard shortcuts

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