fluentdforward

package
v0.0.0-...-d14a738 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package fluentdforward provides output implementations for fluentd "Forward" protocol, split into:

- eventSerializer serializes log records into msgpack formatted events one by one

- messagePacker joins and compresses events into msgpack Forward messages, equals to entire requests in the protocol.

- clientWorker sends out the messages to upstream fluentd, and handles other protocol parts such as auth and ping.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeEventTime

func EncodeEventTime(buffer []byte, start int, value time.Time) int

EncodeEventTime encodes time.Time as fluentd's EventTime.

EventTime is not part of msgpack but fluentd's extension type.

func MustNewEventSerializer

func MustNewEventSerializer(parentLogger logger.Logger, schema base.LogSchema, config SerializationConfig) base.LogSerializer

MustNewEventSerializer creates ForwardLogEventSerializer or panic

func NewClientWorker

func NewClientWorker(parentLogger logger.Logger, args base.ChunkConsumerArgs, config UpstreamConfig, metricCreator promreg.MetricCreator) base.ChunkConsumer

NewClientWorker creates ClientWorker

func NewEventSerializer

func NewEventSerializer(parentLogger logger.Logger, schema base.LogSchema, config SerializationConfig) (base.LogSerializer, error)

NewEventSerializer creates a LogSerializer to serialize log records into fluentd's MessagePackEventStream (as ForwardMessage.Entries) MessagePackEventStream is a sequence of log records in msgpack format: [timestamp, map of fields] "environment" map is nested inside the map of fields

Types

type Config

type Config struct {
	bconfig.Header `yaml:",inline"`
	Serialization  SerializationConfig         `yaml:"serialization"`
	MessageMode    forwardprotocol.MessageMode `yaml:"messageMode"`
	Upstream       UpstreamConfig              `yaml:"upstream"`
}

Config defines configuration for fluentd-forward output

func (*Config) DecodeChunkToJSON

func (cfg *Config) DecodeChunkToJSON(chunk base.LogChunk, separator []byte, indented bool, writer io.Writer) (base.LogChunkInfo, error)

func (*Config) MatchChunkID

func (cfg *Config) MatchChunkID(chunkID string) bool

MatchChunkID checks whether given ID is valid for a fluentdforward chunk file

func (*Config) NewChunkMaker

func (cfg *Config) NewChunkMaker(parentLogger logger.Logger, tag string) base.LogChunkMaker

NewChunkMaker creates LogChunkMaker

func (*Config) NewForwarder

func (cfg *Config) NewForwarder(parentLogger logger.Logger, args base.ChunkConsumerArgs, metricCreator promreg.MetricCreator) base.ChunkConsumer

NewForwarder creates the forwarding client

func (*Config) NewSerializer

func (cfg *Config) NewSerializer(parentLogger logger.Logger, schema base.LogSchema, tag string) base.LogSerializer

NewSerializer creates LogSerializer

func (*Config) VerifyConfig

func (cfg *Config) VerifyConfig(schema base.LogSchema) error

VerifyConfig verifies the configuration

type SerializationConfig

type SerializationConfig struct {
	EnvironmentFields []string                                     `yaml:"environmentFields"`
	HiddenFields      []string                                     `yaml:"hiddenFields"`
	RewriteFields     map[string][]bconfig.LogRewriterConfigHolder `yaml:"rewriteFields"`
}

SerializationConfig defines the serialization section in config file

type UpstreamConfig

type UpstreamConfig struct {
	Address     string        `yaml:"address"`
	TLS         bool          `yaml:"tls"`
	Secret      string        `yaml:"secret"`
	MaxDuration time.Duration `yaml:"maxDuration"`
}

UpstreamConfig defines the upstream section in config file

Jump to

Keyboard shortcuts

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