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 ¶
- func EncodeEventTime(buffer []byte, start int, value time.Time) int
- func MustNewEventSerializer(parentLogger logger.Logger, schema base.LogSchema, config SerializationConfig) base.LogSerializer
- func NewClientWorker(parentLogger logger.Logger, args base.ChunkConsumerArgs, config UpstreamConfig, ...) base.ChunkConsumer
- func NewEventSerializer(parentLogger logger.Logger, schema base.LogSchema, config SerializationConfig) (base.LogSerializer, error)
- type Config
- func (cfg *Config) DecodeChunkToJSON(chunk base.LogChunk, separator []byte, indented bool, writer io.Writer) (base.LogChunkInfo, error)
- func (cfg *Config) MatchChunkID(chunkID string) bool
- func (cfg *Config) NewChunkMaker(parentLogger logger.Logger, tag string) base.LogChunkMaker
- func (cfg *Config) NewForwarder(parentLogger logger.Logger, args base.ChunkConsumerArgs, ...) base.ChunkConsumer
- func (cfg *Config) NewSerializer(parentLogger logger.Logger, schema base.LogSchema, tag string) base.LogSerializer
- func (cfg *Config) VerifyConfig(schema base.LogSchema) error
- type SerializationConfig
- type UpstreamConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeEventTime ¶
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 (*Config) MatchChunkID ¶
MatchChunkID checks whether given ID is valid for a fluentdforward chunk file
func (*Config) NewChunkMaker ¶
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
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