graylog

package
v1.24.4 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 22 Imported by: 9

README

Graylog Output Plugin

This plugin writes to a Graylog instance using the "GELF" format.

GELF Fields

The GELF spec spec defines a number of specific fields in a GELF payload. These fields may have specific requirements set by the spec and users of the Graylog plugin need to follow these requirements or metrics may be rejected due to invalid data.

For example, the timestamp field defined in the GELF spec, is required to be a UNIX timestamp. This output plugin will not modify or check the timestamp field if one is present and send it as-is to Graylog. If the field is absent then Telegraf will set the timestamp to the current time.

Any field not defined by the spec will have an underscore (e.g. _) prefixed to the field name.

Global configuration options

In addition to the plugin-specific configuration settings, plugins support additional global and plugin configuration settings. These settings are used to modify metrics, tags, and field or create aliases and configure ordering, etc. See the CONFIGURATION.md for more details.

Configuration

# Send telegraf metrics to graylog
[[outputs.graylog]]
  ## Endpoints for your graylog instances.
  servers = ["udp://127.0.0.1:12201"]

  ## Connection timeout.
  # timeout = "5s"

  ## The field to use as the GELF short_message, if unset the static string
  ## "telegraf" will be used.
  ##   example: short_message_field = "message"
  # short_message_field = ""

  ## According to GELF payload specification, additional fields names must be prefixed
  ## with an underscore. Previous versions did not prefix custom field 'name' with underscore.
  ## Set to true for backward compatibility.
  # name_field_no_prefix = false

  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = false

Server endpoint may be specified without UDP or TCP scheme (eg. "127.0.0.1:12201"). In such case, UDP protocol is assumed. TLS config is ignored for UDP endpoints.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TCPServer added in v1.24.3

func TCPServer(t *testing.T, wg *sync.WaitGroup, tlsConfig *tls.Config, address chan string, errs chan error)

func TestWriteTCP added in v1.24.3

func TestWriteTCP(t *testing.T)

func TestWriteUDP added in v1.24.3

func TestWriteUDP(t *testing.T)

func UDPServer added in v1.24.3

func UDPServer(t *testing.T, wg *sync.WaitGroup, config *Graylog, address chan string, errs chan error)

Types

type GelfObject added in v1.24.3

type GelfObject map[string]interface{}

type Graylog

type Graylog struct {
	Servers           []string        `toml:"servers"`
	ShortMessageField string          `toml:"short_message_field"`
	NameFieldNoPrefix bool            `toml:"name_field_noprefix"`
	Timeout           config.Duration `toml:"timeout"`
	tlsint.ClientConfig
	// contains filtered or unexported fields
}

func (*Graylog) Close

func (g *Graylog) Close() error

func (*Graylog) Connect

func (g *Graylog) Connect() error

func (*Graylog) SampleConfig

func (*Graylog) SampleConfig() string

func (*Graylog) Write

func (g *Graylog) Write(metrics []telegraf.Metric) error

Jump to

Keyboard shortcuts

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